mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
Mount an empty /dev/shm tmpfs in the chroot
This ensures that whatever the builder writes in /dev/shm is automatically cleaned up.
This commit is contained in:
parent
3ee208516f
commit
42f5a2fc29
1 changed files with 6 additions and 0 deletions
|
@ -1869,6 +1869,12 @@ void DerivationGoal::initChild()
|
||||||
if (mount("none", (chrootRootDir + "/proc").c_str(), "proc", 0, 0) == -1)
|
if (mount("none", (chrootRootDir + "/proc").c_str(), "proc", 0, 0) == -1)
|
||||||
throw SysError("mounting /proc");
|
throw SysError("mounting /proc");
|
||||||
|
|
||||||
|
/* Mount a new tmpfs on /dev/shm to ensure that whatever
|
||||||
|
the builder puts in /dev/shm is cleaned up automatically. */
|
||||||
|
if (pathExists("/dev/shm"))
|
||||||
|
if (mount("none", (chrootRootDir + "/dev/shm").c_str(), "tmpfs", 0, 0) == -1)
|
||||||
|
throw SysError("mounting /dev/shm");
|
||||||
|
|
||||||
/* Do the chroot(). Below we do a chdir() to the
|
/* Do the chroot(). Below we do a chdir() to the
|
||||||
temporary build directory to make sure the current
|
temporary build directory to make sure the current
|
||||||
directory is in the chroot. (Actually the order
|
directory is in the chroot. (Actually the order
|
||||||
|
|
Loading…
Reference in a new issue