From 8b13b4ce6b5c5998ea8dc6db0c1021f2beba41aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Date: Fri, 5 Nov 2021 11:30:28 +0100 Subject: [PATCH] Suppress a spurious warning in emacsclient * lib-src/emacsclient.c (set_local_socket): Suppress warning about unset XDG_RUNTIME_DIR if the variable is actually set. (Bug#51327) --- lib-src/emacsclient.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 0e800dd7e8..d812ae6bc8 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1447,6 +1447,7 @@ set_local_socket (char const *server_name) int tmpdirlen = -1; int socknamelen = -1; uid_t uid = geteuid (); + char const *xdg_runtime_dir = NULL; bool tmpdir_used = false; int s = cloexec_socket (AF_UNIX, SOCK_STREAM, 0); if (s < 0) @@ -1468,7 +1469,7 @@ set_local_socket (char const *server_name) { /* socket_name is a file name component. */ sock_status = ENOENT; - char const *xdg_runtime_dir = egetenv ("XDG_RUNTIME_DIR"); + xdg_runtime_dir = egetenv ("XDG_RUNTIME_DIR"); if (xdg_runtime_dir) { socknamelen = snprintf (sockname, socknamesize, "%s/emacs/%s", @@ -1559,7 +1560,8 @@ set_local_socket (char const *server_name) int sockdirnamelen = snprintf (sockdirname, sizeof sockdirname, "/run/user/%"PRIuMAX, id); if (0 <= sockdirnamelen && sockdirnamelen < sizeof sockdirname - && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0) + && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0 + && !xdg_runtime_dir) message (true, ("%s: Should XDG_RUNTIME_DIR='%s' be in the environment?\n" -- 2.33.1