diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c index 0fadc16fbd..27bb7a969c 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c @@ -98,15 +98,17 @@ void server_forward_kmsg( log_debug_errno(errno, "Failed to write to /dev/kmsg for logging: %m"); } -static bool is_us(const char *pid) { - pid_t t; +static bool is_us(const char *identifier, const char *pid) { + pid_t pid_num; - assert(pid); - - if (parse_pid(pid, &t) < 0) + if (!identifier || !pid) return false; - return t == getpid_cached(); + if (parse_pid(pid, &pid_num) < 0) + return false; + + return pid_num == getpid_cached() && + streq(identifier, program_invocation_short_name); } static void dev_kmsg_record(Server *s, const char *p, size_t l) { @@ -292,7 +294,7 @@ static void dev_kmsg_record(Server *s, const char *p, size_t l) { /* Avoid any messages we generated ourselves via * log_info() and friends. */ - if (pid && is_us(pid)) + if (is_us(identifier, pid)) goto finish; if (identifier) {