mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ Strings readDirectory(const Path & path);
|
|||
|
||||
/* Read the contents of a file into a string. */
|
||||
string readFile(int fd);
|
||||
string readFile(const Path & path);
|
||||
string readFile(const Path & path, bool drain = false);
|
||||
|
||||
/* Write a string to a file. */
|
||||
void writeFile(const Path & path, const string & s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue