summaryrefslogtreecommitdiff
path: root/src/kmsg-syslogd.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-16 02:55:55 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-16 02:55:55 +0100
commitdfa7f7e139e465c7685fd530d61a52c41184bcde (patch)
tree6329c6a316fc18be850b80149708cd49444d3462 /src/kmsg-syslogd.c
parentf9b72cd804f99222cf999c63eb3610a7f54bbf2c (diff)
main: check if we have a valid PID before getting the name of it
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 */