mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 03:13:24 +00:00
Fix compiler thinking tmpdir may be unitialised in emacsclient
This fixes the following warning: emacsclient.c: In function ‘set_local_socket’: /usr/include/x86_64-linux-gnu/bits/string3.h:111:3: error: ‘tmpdir’ may be used uninitialized in this function [-Werror=maybe-uninitialized] return __builtin___stpcpy_chk (__dest, __src, __bos (__dest)); ^ emacsclient.c:1197:17: note: ‘tmpdir’ was declared here const char *tmpdir; * lib-src/emacsclient.c (set_local_socket): Get rid of use_tmpdir variable and instead use tmpdir being non-NULL as sign that it should be used.
This commit is contained in:
parent
5d7433aba3
commit
ef474bd3d6
1 changed files with 2 additions and 4 deletions
|
@ -1191,10 +1191,9 @@ set_local_socket (const char *local_socket_name)
|
|||
|
||||
{
|
||||
int sock_status;
|
||||
int use_tmpdir = 0;
|
||||
int saved_errno;
|
||||
const char *server_name = local_socket_name;
|
||||
const char *tmpdir;
|
||||
const char *tmpdir = NULL;
|
||||
char *tmpdir_storage = NULL;
|
||||
char *socket_name_storage = NULL;
|
||||
|
||||
|
@ -1202,7 +1201,6 @@ set_local_socket (const char *local_socket_name)
|
|||
{
|
||||
/* socket_name is a file name component. */
|
||||
long uid = geteuid ();
|
||||
use_tmpdir = 1;
|
||||
tmpdir = egetenv ("TMPDIR");
|
||||
if (!tmpdir)
|
||||
{
|
||||
|
@ -1240,7 +1238,7 @@ set_local_socket (const char *local_socket_name)
|
|||
/* See if the socket exists, and if it's owned by us. */
|
||||
sock_status = socket_status (server.sun_path);
|
||||
saved_errno = errno;
|
||||
if (sock_status && use_tmpdir)
|
||||
if (sock_status && tmpdir)
|
||||
{
|
||||
/* Failing that, see if LOGNAME or USER exist and differ from
|
||||
our euid. If so, look for a socket based on the UID
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue