monitor: Only print credentials if PID is set
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 1 Jun 2023 23:26:15 +0000 (16:26 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 13:34:03 +0000 (19:04 +0530)
If PID is not set don't print anything since this is likely a packet
originated by the kernel itself.

monitor/packet.c

index 9a973d3..de5c068 100755 (executable)
@@ -437,7 +437,7 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident,
                        pos += n;
        }
 
-       if (cred) {
+       if (cred && cred->pid) {
                cred_pid(cred, pid_str, sizeof(pid_str));
                n = sprintf(line + pos, "%s: %c %s", pid_str, ident,
                                                label ? label : "");