]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/pager: Call _exit in signal handler, not raise
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Feb 2026 20:21:07 +0000 (21:21 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Feb 2026 20:21:07 +0000 (21:21 +0100)
The signals are registered without SA_RESETHAND, which means that the
same signal handler is called over and over again.

This just works because eventually, the waitpid call will fail, leading
to a suppressed error message (because stderr is already closed) and
then an _exit(EXIT_FAILURE) call.

Just call _exit(EXIT_FAILURE) directly to avoid unneeded and failing
system calls.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
lib/pager.c

index 9cbf6383f5ea5b27bb97aae5a7770b3a73020497..19bbb0781ea8ae77f80072b7fe42d714638110f5 100644 (file)
@@ -113,11 +113,11 @@ static void wait_for_pager(void)
        } while (waiting == -1);
 }
 
-static void wait_for_pager_signal(int signo)
+static void wait_for_pager_signal(int signo __attribute__ ((__unused__)))
 {
        UL_PROTECT_ERRNO;
        wait_for_pager();
-       raise(signo);
+       _exit(EXIT_FAILURE);
 }
 
 static int has_command(const char *cmd)