]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
su: Remove dead code
authorTobias Stoeckmann <tobias@stoeckmann.org>
Fri, 9 Jan 2026 16:32:37 +0000 (17:32 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Sun, 11 Jan 2026 14:46:59 +0000 (15:46 +0100)
The pid_child is never 0 when reaching kill_child, since kill_child
is called within an if-block which checks explicitly for pid_child not
being 0.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Ruihan Li <lrh2000@pku.edu.cn>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
src/su.c

index 5e8033abaa5b40001ccd3ffd76bfc5e4a7ad5b1a..15add1c55544bfaf81597ee09da7a7933818a06c 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -169,12 +169,8 @@ static bool iswheel (const char *username)
 static void
 kill_child(pid_t pid_child)
 {
-       if (0 != pid_child) {
-               (void) kill (-pid_child, SIGKILL);
-               fputs(_(" ...killed.\n"), stderr);
-       } else {
-               fputs(_(" ...waiting for child to terminate.\n"), stderr);
-       }
+       kill(-pid_child, SIGKILL);
+       fputs(_(" ...killed.\n"), stderr);
        _exit (255);
 }