diff --git a/src/fs/FileSystem.cxx b/src/fs/FileSystem.cxx index 6da574a8e..cf90bf4cb 100644 --- a/src/fs/FileSystem.cxx +++ b/src/fs/FileSystem.cxx @@ -22,7 +22,6 @@ #include "AllocatedPath.hxx" #include "Limits.hxx" #include "system/Error.hxx" -#include "system/fd_util.h" #include #include @@ -73,11 +72,9 @@ TruncateFile(Path path) CloseHandle(h); #else - int fd = open_cloexec(path.c_str(), O_WRONLY|O_TRUNC, 0); - if (fd < 0) + UniqueFileDescriptor fd; + if (!fd.Open(path.c_str(), O_WRONLY|O_TRUNC)) throw FormatErrno("Failed to truncate %s", path.c_str()); - - close(fd); #endif }