]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
log: do not use uninitialized value
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Feb 2021 10:07:35 +0000 (19:07 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 9 Feb 2021 12:58:12 +0000 (13:58 +0100)
Follow-up for 85cf96e3f567cd51f79d671bbf3559550fdd67b7.

src/basic/log.c

index 6a86fab3986c88299b370e7ab0fd446102aaa700..ff501af5699c6cbe03a2f1b34765dac5169b1dde 100644 (file)
@@ -1175,9 +1175,11 @@ static bool should_parse_proc_cmdline(void) {
                 /* For testing. */
                 return true;
 
-        if (parse_pid(e, &p) < 0)
+        if (parse_pid(e, &p) < 0) {
                 /* We know that systemd sets the variable correctly. Something else must have set it. */
                 log_debug("Failed to parse \"$SYSTEMD_EXEC_PID=%s\". Ignoring.", e);
+                return false;
+        }
 
         return getpid_cached() == p;
 }