diff options
Diffstat (limited to 'src/fs/io/FileOutputStream.cxx')
-rw-r--r-- | src/fs/io/FileOutputStream.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx index ddf7208a7..e9ce40387 100644 --- a/src/fs/io/FileOutputStream.cxx +++ b/src/fs/io/FileOutputStream.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "FileOutputStream.hxx" #include "system/Error.hxx" +#include "util/StringFormat.hxx" FileOutputStream::FileOutputStream(Path _path, Mode _mode) :path(_path), mode(_mode) @@ -212,10 +213,9 @@ FileOutputStream::Commit() unlink(GetPath().c_str()); /* hard-link the temporary file to the final path */ - char fd_path[64]; - snprintf(fd_path, sizeof(fd_path), "/proc/self/fd/%d", - fd.Get()); - if (linkat(AT_FDCWD, fd_path, AT_FDCWD, path.c_str(), + if (linkat(AT_FDCWD, + StringFormat<64>("/proc/self/fd/%d", fd.Get()), + AT_FDCWD, path.c_str(), AT_SYMLINK_FOLLOW) < 0) throw FormatErrno("Failed to commit %s", path.c_str()); |