aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/archive.cc
diff options
context:
space:
mode:
authorsqualus <squalus@squalus.net>2022-09-22 12:47:43 -0700
committersqualus <squalus@squalus.net>2022-09-22 12:50:32 -0700
commit223f8dace091a0549f86b966b1d935c42bb01efd (patch)
tree391ed8b4a68a6239bcfd466ece9529054ecd1eca /src/libutil/archive.cc
parentf704c2720f136a6bb73a2e91d4a85e0e9a42ff6f (diff)
archive: check close errors when extracting nars
Diffstat (limited to 'src/libutil/archive.cc')
-rw-r--r--src/libutil/archive.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index 30b471af5..4b0636129 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -234,6 +234,7 @@ static void parse(ParseSink & sink, Source & source, const Path & path)
else if (s == "contents" && type == tpRegular) {
parseContents(sink, source, path);
+ sink.closeRegularFile();
}
else if (s == "executable" && type == tpRegular) {
@@ -324,6 +325,12 @@ struct RestoreSink : ParseSink
if (!fd) throw SysError("creating file '%1%'", p);
}
+ void closeRegularFile() override
+ {
+ /* Call close explicitly to make sure the error is checked */
+ fd.close();
+ }
+
void isExecutable() override
{
struct stat st;