aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2018-12-01 23:06:06 -0800
committerPaul Eggert2018-12-01 23:08:48 -0800
commit92282cb50248117185774cf8076d1ff83d501be7 (patch)
tree0e03dbd31e82b3f962b54c88ce0be1290b23d7ff /lisp
parent070ef95c1007cb3d54e04bc337d9fb5463912cc1 (diff)
downloademacs-92282cb50248117185774cf8076d1ff83d501be7.tar.gz
emacs-92282cb50248117185774cf8076d1ff83d501be7.zip
emacsclient: prefer XDG_RUNTIME_DIR (Bug#33367)
* lib-src/emacsclient.c: Disable -Wformat-truncation=2, to avoid false alarms about the new snprintf calls. (local_sockname): New function. (set_local_socket): Use it. Prefer XDG_RUNTIME_DIR (if set) for location of socket directory. Avoid unnecessary memory allocation by using snprintf to destination. * lisp/server.el (server-socket-dir): Prefer XDG_RUNTIME_DIR if set.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/server.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/server.el b/lisp/server.el
index d0a8ca313e3..28e789a4c88 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -281,7 +281,10 @@ changed while a server is running."
281 (if internal--daemon-sockname 281 (if internal--daemon-sockname
282 (file-name-directory internal--daemon-sockname) 282 (file-name-directory internal--daemon-sockname)
283 (and (featurep 'make-network-process '(:family local)) 283 (and (featurep 'make-network-process '(:family local))
284 (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))) 284 (let ((xdg_runtime_dir (getenv "XDG_RUNTIME_DIR")))
285 (if xdg_runtime_dir
286 (format "%s/emacs" xdg_runtime_dir)
287 (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))))))
285 "The directory in which to place the server socket. 288 "The directory in which to place the server socket.
286If local sockets are not supported, this is nil.") 289If local sockets are not supported, this is nil.")
287 290