aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-06 18:09:25 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-06 18:18:22 +0200
commit26a728eb091daf89a01986eac2d51dc8f0b58b6a (patch)
treec9da62bfb68720692bbb9b4d8c0604eed7487b3c /gnu
parent94e3029a834cb53a60dcef18556f8d207dea85cd (diff)
downloadpatches-26a728eb091daf89a01986eac2d51dc8f0b58b6a.tar
patches-26a728eb091daf89a01986eac2d51dc8f0b58b6a.tar.gz
linux-initrd: Delete files from the initrd ramfs when switching roots.
* guix/build/linux-initrd.scm (switch-root): Delete file from the old root. Chdir to / after 'chroot' call. Re-open file descriptors 0, 1, and 2. (boot-system): Move 'loading' message after the 'switch-root' call. * gnu/system.scm (operating-system-boot-script): Add loop that closes file descriptor before calling 'execl'.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 65d1ca3418..8a5fe47b30 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -334,6 +334,15 @@ we're running in the final root."
;; Activate setuid programs.
(activate-setuid-programs (list #$@setuid-progs))
+ ;; Close any remaining open file descriptors to be on the
+ ;; safe side. This must be the very last thing we do,
+ ;; because Guile has internal FDs such as 'sleep_pipe'
+ ;; that need to be alive.
+ (let loop ((fd 3))
+ (when (< fd 1024)
+ (false-if-exception (close-fdes fd))
+ (loop (+ 1 fd))))
+
;; Start dmd.
(execl (string-append #$dmd "/bin/dmd")
"dmd" "--config" #$dmd-conf)))))