summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2004-07-21 04:24:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:14 -0500
commit0804e231e40e700bb16e400a1eda4d87d4bbc432 (patch)
tree0c37d12bbe944703fb5ccec92cc2f9f5e8877036 /source3
parentc8137eeea40c0b9f5526fd0c9cfd5843a572a8a0 (diff)
downloadsamba-0804e231e40e700bb16e400a1eda4d87d4bbc432.tar.gz
samba-0804e231e40e700bb16e400a1eda4d87d4bbc432.tar.bz2
samba-0804e231e40e700bb16e400a1eda4d87d4bbc432.zip
r1557: Add sigchld handling to winbindd. Next step is to have the child restarted if
need be. We should also make sure the main line know we no longer have a child. (This used to be commit e3dc7934b50c8578d70fc01688a07bd369a7cf30)
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/winbindd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index 50b6f0a87f..d08aa84fac 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -188,6 +188,17 @@ static void sighup_handler(int signum)
sys_select_signal();
}
+static void sigchld_handler(int signum)
+{
+ pid_t pid;
+ int status;
+
+ while ((pid = wait(&status)) != -1 || errno == EINTR) {
+ continue; /* Reap children */
+ }
+ sys_select_signal();
+}
+
/* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/
static void msg_reload_services(int msg_type, pid_t src, void *buf, size_t len)
{
@@ -888,12 +899,14 @@ int main(int argc, char **argv)
BlockSignals(False, SIGUSR1);
BlockSignals(False, SIGUSR2);
BlockSignals(False, SIGHUP);
+ BlockSignals(False, SIGCHLD);
/* Setup signal handlers */
CatchSignal(SIGINT, termination_handler); /* Exit on these sigs */
CatchSignal(SIGQUIT, termination_handler);
CatchSignal(SIGTERM, termination_handler);
+ CatchSignal(SIGCHLD, sigchld_handler);
CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */