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:
parent
f0eab0636b
commit
56e30e161c
3 changed files with 21 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue