diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-06-09T14·15+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-06-09T14·37+0200 |
commit | 202683a4fc148dc228de226e9980a3f27754b854 (patch) | |
tree | dd75cf8f873a913ac3baf222eb93981622407d5f /src/libutil/archive.cc | |
parent | 9bdd949cfdc9e49f1e01460a2a73215cac3ec904 (diff) |
Use O_CLOEXEC in most places
Diffstat (limited to 'src/libutil/archive.cc')
-rw-r--r-- | src/libutil/archive.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc index 5363496c272e..c3e4c87a5599 100644 --- a/src/libutil/archive.cc +++ b/src/libutil/archive.cc @@ -41,7 +41,7 @@ static void dumpContents(const Path & path, size_t size, { sink << "contents" << size; - AutoCloseFD fd = open(path.c_str(), O_RDONLY); + AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC); if (fd == -1) throw SysError(format("opening file ‘%1%’") % path); unsigned char buf[65536]; @@ -304,7 +304,7 @@ struct RestoreSink : ParseSink { Path p = dstPath + path; fd.close(); - fd = open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0666); + fd = open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666); if (fd == -1) throw SysError(format("creating file ‘%1%’") % p); } |