summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-20 21:45:33 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-20 23:43:33 +1000
commita9f5bfb3a5324f09a07657a8bb28bb4510485d31 (patch)
treefbe12f1a74c9ea9cdd1bb449a1f6fa4837aa6f38 /lib/util
parent4f5298cbb4c044b6bde0cda04d182651f826ee53 (diff)
downloadsamba-a9f5bfb3a5324f09a07657a8bb28bb4510485d31.tar.gz
samba-a9f5bfb3a5324f09a07657a8bb28bb4510485d31.tar.bz2
samba-a9f5bfb3a5324f09a07657a8bb28bb4510485d31.zip
util-runcmd: ignore spurious ECHILD errors
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.
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/util_runcmd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c
index d81a0ace93..aa2a3e6672 100644
--- a/lib/util/util_runcmd.c
+++ b/lib/util/util_runcmd.c
@@ -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) {