Hi, this patch simplifies then child handling of the kerberos provider to reduce the number of missleading debug messages.
bye, Sumit
>From e40a3c9cf9b8b1b85d5668fa2491e2e6d48c439b Mon Sep 17 00:00:00 2001 From: Sumit Bose <sb...@redhat.com> Date: Tue, 10 Nov 2009 11:31:29 +0100 Subject: [PATCH] Simplify krb5 child handler Currently the Kerberos child handler evaluates the siginfo_t structure to wait for a specific child. This scheme is prone to error, especially when there are more than one child process active, and can produce missleading debug message. This patch simplifies the scheme as it waits for any child. --- server/providers/krb5/krb5_auth.c | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-) diff --git a/server/providers/krb5/krb5_auth.c b/server/providers/krb5/krb5_auth.c index cc5bc20..a02147e 100644 --- a/server/providers/krb5/krb5_auth.c +++ b/server/providers/krb5/krb5_auth.c @@ -307,26 +307,27 @@ void krb5_child_sig_handler(struct tevent_context *ev, { int ret; int child_status; - siginfo_t *siginfo = (siginfo_t *)__siginfo; - errno = 0; + DEBUG(7, ("Waiting for [%d] childeren.\n", count)); do { - ret = waitpid(siginfo->si_pid, &child_status, WNOHANG); - } while (ret == -1 && errno == EINTR); - if (ret == siginfo->si_pid) { - DEBUG(4, ("child status [%d].\n", child_status)); - if (WEXITSTATUS(child_status) != 0) { - DEBUG(1, ("child failed.\n")); + errno = 0; + ret = waitpid(-1, &child_status, WNOHANG); + + if (ret == -1) { + DEBUG(1, ("waitpid failed [%d][%s].\n", errno, strerror(errno))); + } else if (ret == 0) { + DEBUG(1, ("waitpid did not found a child with changed status.\n")); + } else { + if (WEXITSTATUS(child_status) != 0) { + DEBUG(1, ("child [%d] failed with status [%d].\n", ret, + child_status)); + } else { + DEBUG(4, ("child [%d] finished successful.\n", ret)); + } } - } else if (ret == 0) { - DEBUG(1, ("waitpid did not found a child with changed status.\n", ret)); - } else if (ret >= 0 && ret != siginfo->si_pid) { - DEBUG(1, ("waitpid returned wrong child pid [%d], continue waiting.\n", ret)); - } else if (ret == -1 && errno == ECHILD) { - DEBUG(1, ("no child with pid [%d].\n", siginfo->si_pid)); - } else { - DEBUG(1, ("waitpid failed [%s].\n", strerror(errno))); - } + + --count; + } while (count < 0); return; } -- 1.6.2.5
_______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/sssd-devel