guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#27323] [PATCH v2 shepherd 1/2] Use XDG_RUNTIME_DIR for the shepherd


From: Danny Milosavljevic
Subject: [bug#27323] [PATCH v2 shepherd 1/2] Use XDG_RUNTIME_DIR for the shepherd socket.
Date: Wed, 14 Jun 2017 09:49:01 +0200

---
 modules/shepherd/support.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index e50de74..ea98b5f 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -251,6 +251,11 @@ There is NO WARRANTY, to the extent permitted by law.")))
                      (string-append user-homedir "/.config"))
                  "/shepherd"))
 
+(define %user-runtime-dir
+  ;; Default runtime directory if shepherd is run as a normal user.
+  (string-append (or (getenv "XDG_RUNTIME_DIR")
+                     (format #f "/run/user/~s" (getuid)))))
+
 (define (make-bare-init-file target)
   "Return #t if a bare init file was created at TARGET; #f otherwise.
 
@@ -301,7 +306,7 @@ create a template configuration file if non exists."
 (define default-socket-dir
   (if (zero? (getuid))
       %system-socket-dir
-      (string-append %user-config-dir "/run")))
+      (string-append %user-runtime-dir "/shepherd")))
 
 ;; Unix domain socket for receiving commands in shepherd.
 (define default-socket-file





reply via email to

[Prev in Thread] Current Thread [Next in Thread]