Skip to content

Commit

Permalink
util-runcmd: ignore spurious ECHILD errors
Browse files Browse the repository at this point in the history
when we get ECHILD in samba_runcmd it is because the parent has set
SIGCHLD to SIG_IGN. In that case the child status information is
lost. We then have to fallback on the logging of child error messages
for any useful information on what happened to the child.

A longer term fix is to stop using SIG_IGN for SIGCHLD in the standard
process model of s4.
  • Loading branch information
Andrew Tridgell committed Apr 20, 2010
1 parent 4f5298c commit a9f5bfb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/util/util_runcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,20 @@ static void samba_runcmd_io_handler(struct tevent_context *ev,
* stderr, assume its dead */
pid_t pid = waitpid(state->pid, &status, 0);
if (pid != state->pid) {
if (errno == ECHILD) {
/* this happens when the
parent has set SIGCHLD to
SIG_IGN. In that case we
can only get error
information for the child
via its logging. We should
stop using SIG_IGN on
SIGCHLD in the standard
process model.
*/
tevent_req_done(req);
return;
}
DEBUG(0,("Error in waitpid() for child %s - %s \n",
state->arg0, strerror(errno)));
if (errno == 0) {
Expand Down

0 comments on commit a9f5bfb

Please sign in to comment.