summaryrefslogtreecommitdiff
path: root/src/kmsg-syslogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kmsg-syslogd.c')
-rw-r--r--src/kmsg-syslogd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/kmsg-syslogd.c b/src/kmsg-syslogd.c
index 4edb16136b..c78011fe22 100644
--- a/src/kmsg-syslogd.c
+++ b/src/kmsg-syslogd.c
@@ -354,7 +354,9 @@ static int write_message(Server *s, const char *buf, struct ucred *ucred) {
/* Then, add process if set */
if (read_process(&buf, &iovec[i]) > 0)
i++;
- else if (ucred && get_process_name(ucred->pid, &process) >= 0)
+ else if (ucred &&
+ ucred->pid > 0 &&
+ get_process_name(ucred->pid, &process) >= 0)
IOVEC_SET_STRING(iovec[i++], process);
/* Skip the stored PID if we have a better one */