keventd: drop SIGCHLD save/restore dance, libuev reaps for us

modprobe_load() and run_program() used to temporarily restore the
default SIGCHLD handler around fork+waitpid because the main loop set
SIGCHLD=SIG_IGN.  With the libuev conversion, sigchld_cb in keventd.c
handles reaping via signalfd -- and signalfd does not interfere with
synchronous waitpid(pid, ...) -- so the dance is dead code.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-08-16 22:03:33 +02:00
1 parent 0111dc2178
commit 9d5e646e46
2 files changed
+1 -23

No files matched your search

+1 -12
View File
@@ -782,13 +782,9 @@ static int pattern_match(const char *pat, const char *subject, pat_type_t type)
/* ----- program execution ------------------------------------------------ */
/*
* Fork and exec cmd via /bin/sh, capture stdout into result.
* Temporarily restores SIGCHLD (keventd uses SIG_IGN) so waitpid works.
*/
/* Fork and exec cmd via /bin/sh, capture stdout into result. */
static int run_program(const char *cmd, char *result, size_t rlen)
{
struct sigaction sa_dfl, sa_old;
int pipefd[2];
pid_t pid;
int rc = -1;
@@ -799,14 +795,8 @@ static int run_program(const char *cmd, char *result, size_t rlen)
if (pipe(pipefd) < 0)
return -1;
sigemptyset(&sa_dfl.sa_mask);
sa_dfl.sa_flags = 0;
sa_dfl.sa_handler = SIG_DFL;
sigaction(SIGCHLD, &sa_dfl, &sa_old);
pid = fork();
if (pid < 0) {
sigaction(SIGCHLD, &sa_old, NULL);
close(pipefd[0]);
close(pipefd[1]);
return -1;
@@ -838,7 +828,6 @@ static int run_program(const char *cmd, char *result, size_t rlen)
rc = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
}
sigaction(SIGCHLD, &sa_old, NULL);
return rc;
}