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

In the chroot, make all mounted filesystems private

This is required on systemd, which mounts filesystems as "shared"
subtrees.  Changes to shared trees in a private mount namespace are
propagated to the outside world, which is bad.
This commit is contained in:
Eelco Dolstra 2012-08-20 15:27:30 -04:00
parent f0eab0636b
commit 56e30e161c
3 changed files with 21 additions and 3 deletions

View file

@ -224,12 +224,12 @@ string readFile(int fd)
}
string readFile(const Path & path)
string readFile(const Path & path, bool drain)
{
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
if (fd == -1)
throw SysError(format("opening file `%1%'") % path);
return readFile(fd);
return drain ? drainFD(fd) : readFile(fd);
}