aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/archive.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/archive.cc')
-rw-r--r--src/libutil/archive.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index e3ff7345f..00536c1e1 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -44,7 +44,7 @@ static void dumpContents(const Path & path, off_t size,
{
sink << "contents" << size;
- AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC);
+ AutoCloseFD fd{open(path.c_str(), O_RDONLY | O_CLOEXEC)};
if (!fd) throw SysError("opening file '%1%'", path);
std::vector<char> buf(65536);
@@ -318,7 +318,7 @@ struct RestoreSink : ParseSink
void createRegularFile(const Path & path) override
{
Path p = dstPath + path;
- fd = open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666);
+ fd = AutoCloseFD{open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)};
if (!fd) throw SysError("creating file '%1%'", p);
}