From 00c97a06be66dfca3dc6f4cb7d604c74e1348bc3 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 26 Jul 2022 15:52:43 -0700 Subject: [PATCH] killall: fix a logic error in names_to_pid(). This broke a lot of tests in postsubmit, and even seems to have had the effect of causing reboots (presumably by accidentally killing init) which made it quite hard to track down. Sadly I'm too stupid by this point in the afternoon to come up with the missing test :-( --- lib/lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib.c b/lib/lib.c index c2c65a71..64fe68f2 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1146,7 +1146,7 @@ void names_to_pid(char **names, int (*callback)(pid_t pid, char *name), char buf[32]; sprintf(buf, "/proc/%u/exe", u); - if (stat(buf, &st2) && !same_file(&st1, &st2)) continue; + if (stat(buf, &st2) || !same_file(&st1, &st2)) continue; goto match; } -- 2.39.2