]> git.eshelyaron.com Git - emacs.git/commitdiff
Ensure that server-socket-dir doesn't have "//" in the path
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 13 Aug 2020 10:01:01 +0000 (12:01 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 13 Aug 2020 10:01:01 +0000 (12:01 +0200)
* lisp/server.el (server-socket-dir): Use expand-file-name to
avoid "//" in the path name (if either XDG_RUNTIME_DIR or TMPDIR
ends in a slash) (bug#18658).

lisp/server.el

index 18612181477bff23ca628fb2ab9ff4c3eccadef7..9934e1c1be996829bdadfff42bfee2f4a95f01b6 100644 (file)
@@ -274,10 +274,11 @@ the \"-f\" switch otherwise."
   (if internal--daemon-sockname
       (file-name-directory internal--daemon-sockname)
     (and (featurep 'make-network-process '(:family local))
-        (let ((xdg_runtime_dir (getenv "XDG_RUNTIME_DIR")))
-          (if xdg_runtime_dir
-              (format "%s/emacs" xdg_runtime_dir)
-            (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))))))
+        (let ((runtime-dir (getenv "XDG_RUNTIME_DIR")))
+          (if runtime-dir
+              (expand-file-name "emacs" runtime-dir)
+            (expand-file-name (format "emacs%d" (user-uid))
+                               (or (getenv "TMPDIR") "/tmp"))))))
   "The directory in which to place the server socket.
 If local sockets are not supported, this is nil.")