]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
su: Turn caught into volatile sig_atomic_t
authorTobias Stoeckmann <tobias@stoeckmann.org>
Fri, 9 Jan 2026 16:20:07 +0000 (17:20 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Sun, 11 Jan 2026 14:46:59 +0000 (15:46 +0100)
Only these shared variables can be safely written to by signal handlers.

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 e5ee844280f0a1d37880882d2783e6d87dd6ad69..8c355d07f637474d838723cd3be4984d242ace60 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -97,7 +97,7 @@ static bool change_environment = true;
 static char kill_msg[256];
 static char wait_msg[256];
 static pam_handle_t *pamh = NULL;
-static int caught = 0;
+static volatile sig_atomic_t caught = 0;
 /* PID of the child, in case it needs to be killed */
 static pid_t pid_child = 0;
 #endif