diff mbox series

[BlueZ,1/2] monitor: Only print credentials if PID is set

Message ID 20230601233317.1419030-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,1/2] monitor: Only print credentials if PID is set | expand

Commit Message

Luiz Augusto von Dentz June 1, 2023, 11:33 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If PID is not set don't print anything since this is likely a packet
originated by the kernel itself.
---
 monitor/packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/monitor/packet.c b/monitor/packet.c
index 946ceb2c640d..6d73e5abfcbc 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -438,7 +438,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 : "");