summaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/cxx/file_util.cxx10
-rw-r--r--src/libutil/cxx/file_util.hxx2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/libutil/cxx/file_util.cxx b/src/libutil/cxx/file_util.cxx
index d0860b77b..1993ff666 100644
--- a/src/libutil/cxx/file_util.cxx
+++ b/src/libutil/cxx/file_util.cxx
@@ -145,6 +145,16 @@ auto raii_file::update_stat() noexcept -> bool
return fstat(fd, &st) != -1;
}
+raii_file::raii_file(const char *fname, int fd, bool temp) : fd(fd), temp(temp)
+{
+ std::size_t nsz;
+
+ /* Normalize path */
+ this->fname = fname;
+ rspamd_normalize_path_inplace(this->fname.data(), this->fname.size(), &nsz);
+ this->fname.resize(nsz);
+}
+
raii_locked_file::~raii_locked_file() noexcept
{
diff --git a/src/libutil/cxx/file_util.hxx b/src/libutil/cxx/file_util.hxx
index 097ce03a7..9fbcda540 100644
--- a/src/libutil/cxx/file_util.hxx
+++ b/src/libutil/cxx/file_util.hxx
@@ -126,7 +126,7 @@ protected:
std::string fname;
struct stat st;
- explicit raii_file(const char *fname, int fd, bool temp) : fd(fd), temp(temp), fname(fname) {}
+ explicit raii_file(const char *fname, int fd, bool temp);
};
/**
* A simple RAII object to contain a file descriptor with an flock wrap