From 73d46261344d5bd05c0940bc2ec5f9ed9a47db1b Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Mon, 7 Dec 2009 19:00:04 +0000 Subject: timeout: fix failure if timeout's parent has ignored SIGCHLD * src/timeout.c (main): Reset the SIGCHLD handler to the default as otherwise wait() could return -1 and set errno to ECHILD. This condition was ignored until commit 0b1dcf33, on 31-08-2009, "timeout: defensive handling of all wait() errors" but subsequently timeout would run the command correctly but then fail with an error message. * tests/misc/timeout: In a subshell set the CHLD handler to SIG_IGN to ensure the timeout command resets it to SIG_DFL. * NEWS: Mention the fix. --- src/timeout.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/timeout.c') diff --git a/src/timeout.c b/src/timeout.c index 3babb8c26..c7753d4d2 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -275,6 +275,7 @@ main (int argc, char **argv) install_signal_handlers (term_signal); signal (SIGTTIN, SIG_IGN); /* don't sTop if background child needs tty. */ signal (SIGTTOU, SIG_IGN); /* don't sTop if background child needs tty. */ + signal (SIGCHLD, SIG_DFL); /* Don't inherit CHLD handling from parent. */ monitored_pid = fork (); if (monitored_pid == -1) -- cgit v1.2.3-54-g00ecf