build: container: Make 'unprivileged-user-namespace-supported?' more robust.

* gnu/build/linux-container.scm (unprivileged-user-namespace-supported?): Only
  read and check the first character, to cope with a possible newline in the
  (pseudo-)file.
This commit is contained in:
Mark H Weaver 2016-01-23 18:40:33 -05:00
parent fe17fb4a2c
commit c5184468f5
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@
"Return #t if user namespaces can be created by unprivileged users." "Return #t if user namespaces can be created by unprivileged users."
(let ((userns-file "/proc/sys/kernel/unprivileged_userns_clone")) (let ((userns-file "/proc/sys/kernel/unprivileged_userns_clone"))
(if (file-exists? userns-file) (if (file-exists? userns-file)
(string=? "1" (call-with-input-file userns-file read-string)) (eqv? #\1 (call-with-input-file userns-file read-char))
#t))) #t)))
(define (setgroups-supported?) (define (setgroups-supported?)