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(-)
From c4dbb246fefb6e907f81e968597626a9be70c672 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
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.37.1.359.gd136c6c3e2-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to