X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fsocket-util.c;h=5ef2e2244c0406874fd8b7cbdd067a610c853fb2;hp=4700b3bc9950a49c1fee8c19866e3b3fa1ee37c1;hb=53ede806cb58c661efbee6bbaabee6b2f0d3ce79;hpb=79a98c609da042c60260e8e0236464014d480dcb diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c index 4700b3bc9..5ef2e2244 100644 --- a/src/shared/socket-util.c +++ b/src/shared/socket-util.c @@ -585,7 +585,7 @@ int getpeername_pretty(int fd, char **ret) { return -errno; if (sa.sa.sa_family == AF_UNIX) { - struct ucred ucred; + struct ucred ucred = {}; /* UNIX connection sockets are anonymous, so let's use * PID/UID as pretty credentials instead */ @@ -594,7 +594,7 @@ int getpeername_pretty(int fd, char **ret) { if (r < 0) return r; - if (asprintf(ret, "PID %lu/UID %lu", (unsigned long) ucred.pid, (unsigned long) ucred.pid) < 0) + if (asprintf(ret, "PID %lu/UID %lu", (unsigned long) ucred.pid, (unsigned long) ucred.uid) < 0) return -ENOMEM; return 0;