RestoreSink: Slightly reduce the number of concurrent FDs

This commit is contained in:
Eelco Dolstra 2013-09-17 12:06:59 +00:00
parent d5529f5b85
commit f53574ebd6

View file

@ -282,6 +282,7 @@ struct RestoreSink : ParseSink
void createRegularFile(const Path & path) void createRegularFile(const Path & path)
{ {
Path p = dstPath + path; 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, 0666);
if (fd == -1) throw SysError(format("creating file `%1%'") % p); if (fd == -1) throw SysError(format("creating file `%1%'") % p);
} }