diff --git a/keventd/rules.c b/keventd/rules.c index 31580a47..48e46294 100644 --- a/keventd/rules.c +++ b/keventd/rules.c @@ -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; } diff --git a/keventd/uevent.c b/keventd/uevent.c index 6c6801aa..10a3d021 100644 --- a/keventd/uevent.c +++ b/keventd/uevent.c @@ -1038,13 +1038,9 @@ fail: * Synchronous: waits for modprobe to complete before returning so * that rules running after `kmod load` (e.g. IMPORT{builtin}=blkid * once the filesystem driver is in) see the post-load state. - * keventd's main loop uses SIGCHLD=SIG_IGN to auto-reap stray - * children, so we temporarily restore the default handler here to - * make waitpid() observable. */ int modprobe_load(const char *modalias) { - struct sigaction sa_dfl, sa_old; pid_t pid; int status = 0; @@ -1053,15 +1049,9 @@ int modprobe_load(const char *modalias) logit(LOG_DEBUG, "Loading module for %s", modalias); - 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) { logit(LOG_ERR, "fork failed: %s", strerror(errno)); - sigaction(SIGCHLD, &sa_old, NULL); return -1; } @@ -1072,7 +1062,6 @@ int modprobe_load(const char *modalias) while (waitpid(pid, &status, 0) < 0 && errno == EINTR) ; - sigaction(SIGCHLD, &sa_old, NULL); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) return -1;