1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Use /proc/self/fd to efficiently close all FDs on Linux

Issue #1506.
This commit is contained in:
Eelco Dolstra 2017-08-09 16:22:05 +02:00
parent c6184dec6c
commit af765a8eab
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 19 additions and 5 deletions

View file

@ -2556,7 +2556,7 @@ void DerivationGoal::runChild()
throw SysError(format("changing into '%1%'") % tmpDir);
/* Close all other file descriptors. */
closeMostFDs(set<int>());
closeMostFDs({STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO});
#if __linux__
/* Change the personality to 32-bit if we're doing an