* src/timeout.c (cleanup): Handle the case where monitored_pid
might be -1, which could happen if a signal was received
immediately after a failed fork() call. In that case it would
send the termination signal to all processes that the timeout
process has permission to send signals too.
* NEWS: Mention the bug fix.
on systems with a page size larger than the stdio BUFSIZ.
[This bug was present in "the beginning".]
+ timeout avoids a narrow race condition, where it might kill arbitrary
+ processes after a failed process fork.
+ [bug introduced with timeout in coreutils-7.0]
+
wc no longer fails to count unprintable characters as parts of words.
[bug introduced in textutils-2.1]
timed_out = 1;
sig = term_signal;
}
- if (monitored_pid)
+ if (0 < monitored_pid)
{
if (kill_after)
{
}
}
}
- else /* we're the child or the child is not exec'd yet. */
- _exit (128 + sig);
+ else if (monitored_pid == -1)
+ { /* were in the parent, so let it continue to exit below. */
+ }
+ else /* monitored_pid == 0 */
+ { /* we're the child or the child is not exec'd yet. */
+ _exit (128 + sig);
+ }
}
void