chiark / gitweb /
util: detect page size runtime.
[elogind.git] / src / kmsg-syslogd.c
index 4edb16136b58cb6ac1a53b37b2cc159138c86f04..c78011fe226d56cf06e1a067646358d27f4a55b4 100644 (file)
@@ -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 */