summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/build/linux-initrd.scm25
1 files changed, 9 insertions, 16 deletions
diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm
index 6dd7c6e958..16c741f931 100644
--- a/guix/build/linux-initrd.scm
+++ b/guix/build/linux-initrd.scm
@@ -324,22 +324,15 @@ bailing out.~%root contents: ~s~%" (scandir "/"))
(when (file-exists? "/dev/console")
;; Close the standard file descriptors since they refer to the old
- ;; /dev/console.
- (for-each close-fdes '(0 1 2))
-
- ;; Reopen them.
- (let ((in (open-file "/dev/console" "rbl"))
- (out (open-file "/dev/console" "wbl")))
- (dup2 (fileno in) 0)
- (dup2 (fileno out) 1)
- (dup2 (fileno out) 2)
-
- ;; Safely close IN and OUT.
- (for-each (lambda (port)
- (if (memv (fileno port) '(0 1 2))
- (set-port-revealed! port 1)
- (close-port port)))
- (list in out)))))
+ ;; /dev/console, and reopen them.
+ (let ((console (open-file "/dev/console" "r+b0")))
+ (for-each close-fdes '(0 1 2))
+
+ (dup2 (fileno console) 0)
+ (dup2 (fileno console) 1)
+ (dup2 (fileno console) 2)
+
+ (close-port console))))
(define* (boot-system #:key
(linux-modules '())