summary refs log tree commit diff
path: root/gnu/services/xorg.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-03-01 19:05:29 -0500
committerMark H Weaver <mhw@netris.org>2015-03-01 19:05:29 -0500
commit3820d3973982048e5b93ad08d619c893bc50de14 (patch)
tree159a3ea785647fb8bb5e4b754f5c0f98d86e29d5 /gnu/services/xorg.scm
parent751be9a056114d353bac12510bea33e8d5577f49 (diff)
parentafff9058a0a9a3f3d633f563bb8a1a7d9e503165 (diff)
downloadguix-3820d3973982048e5b93ad08d619c893bc50de14.tar.gz
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/gnupg.scm
Diffstat (limited to 'gnu/services/xorg.scm')
-rw-r--r--gnu/services/xorg.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 69a89584e0..bc1774840b 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -155,6 +155,13 @@ which should be passed to this script as the first argument.  If not, the
     #~(begin
         (use-modules (ice-9 match))
 
+        (define (close-all-fdes)
+          ;; Close all the open file descriptors.
+          (let loop ((fd 0))
+            (when (< fd 4096)               ;FIXME: use sysconf + _SC_OPEN_MAX
+              (false-if-exception (close-fdes fd))
+              (loop (+ 1 fd)))))
+
         (define (exec-from-login-shell command . args)
           ;; Run COMMAND from a login shell so that it gets to see the same
           ;; environment variables that one gets when logging in on a tty, for
@@ -163,6 +170,11 @@ which should be passed to this script as the first argument.  If not, the
                  (shell (passwd:shell pw))
                  (st    (stat command #f)))
             (when (and st (not (zero? (logand (stat:mode st) #o100))))
+              ;; Close any open file descriptors.  This is all the more
+              ;; important that SLiM itself exec's us directly without closing
+              ;; its own file descriptors!
+              (close-all-fdes)
+
               ;; The '--login' option is supported at least by Bash and zsh.
               (execl shell shell "--login" "-c"
                      (string-join (cons command args))))))