From 47b73c34f0ac1fbe2cacb9233e7e41cdcfef9caf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Thu, 24 Jul 2014 19:38:50 +0200
Subject: [PATCH] services: xorg: Remove /var/run/slim.lock when starting.

Reported by Mark H. Weaver.

* gnu/services/xorg.scm (slim-service)[start]: Remove /var/run/slim.lock
  before starting 'slim'.
---
 gnu/services/xorg.scm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 7ca0d3f7db7..04d1296edc3 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -146,10 +146,15 @@ (define (slim.cfg)
       (provision '(xorg-server))
       (requirement '(user-processes host-name udev))
       (start
-       #~(make-forkexec-constructor
-          (list (string-append #$slim "/bin/slim") "-nodaemon")
-          #:environment-variables
-          (list (string-append "SLIM_CFGFILE=" #$slim.cfg))))
+       #~(lambda ()
+           ;; A stale lock file can prevent SLiM from starting, so remove it
+           ;; to be on the safe side.
+           (false-if-exception (delete-file "/var/run/slim.lock"))
+
+           (fork+exec-command
+            (list (string-append #$slim "/bin/slim") "-nodaemon")
+            #:environment-variables
+            (list (string-append "SLIM_CFGFILE=" #$slim.cfg)))))
       (stop #~(make-kill-destructor))
       (respawn? #t)
       (pam-services
-- 
GitLab