This warning can be fixed like the one in test-raise.c: test-sigpipe.c:34:3: warning: call to 'exit' from within signal handler [CWE-479] [-Wanalyzer-unsafe-call-within-signal-handler]
2023-09-04 Bruno Haible <br...@clisp.org> sigpipe tests: Fix -Wanalyzer-unsafe-call-within-signal-handler warning. * tests/test-sigpipe.c (handler): Invoke _exit, not exit. * tests/test-raise.c (handler): Update comments after 2020-11-25 change. diff --git a/tests/test-raise.c b/tests/test-raise.c index 97be64dd2c..38088a53ea 100644 --- a/tests/test-raise.c +++ b/tests/test-raise.c @@ -26,9 +26,9 @@ SIGNATURE_CHECK (raise, int, (int)); #include "macros.h" -/* It is safe to use _Noreturn here: exit() never returns, and GCC knows that - exit() is a non-returning function, even on platforms where its declaration - in <stdlib.h> does not have the 'noreturn' attribute. */ +/* It is safe to use _Noreturn here: _exit() never returns, and GCC knows that + _exit() is a non-returning function, even on platforms where its declaration + in <unistd.h> does not have the 'noreturn' attribute. */ static _Noreturn void handler (_GL_UNUSED int sig) { diff --git a/tests/test-sigpipe.c b/tests/test-sigpipe.c index ab8745b3bd..efff9d55f8 100644 --- a/tests/test-sigpipe.c +++ b/tests/test-sigpipe.c @@ -31,7 +31,7 @@ int s = SIGPIPE; static void handler (int sig) { - exit (0); + _exit (0); } int