summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1999-01-14 18:29:55 +0000
committerJeremy Allison <jra@samba.org>1999-01-14 18:29:55 +0000
commit7663ead8d83e2a9d248925861e67c055a080322e (patch)
treeab386216857155f44896ee0622d68491f8d6b10f
parentd3f5175c1fc010b0d15aecb1483bdbe09512a7b4 (diff)
downloadsamba-7663ead8d83e2a9d248925861e67c055a080322e.tar.gz
samba-7663ead8d83e2a9d248925861e67c055a080322e.tar.xz
samba-7663ead8d83e2a9d248925861e67c055a080322e.zip
Fixed problem where with POSIX signal handling (as used in Solaris and
IRIX) we would infinately loop on a SIGCLD in the password changing code. Just lucky we didn't get bitten in the generic SIGCLD case (but I fixed that too). Jeremy.
-rw-r--r--source/lib/signal.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source/lib/signal.c b/source/lib/signal.c
index 1d2e1e8d166..1e27052beb8 100644
--- a/source/lib/signal.c
+++ b/source/lib/signal.c
@@ -31,7 +31,16 @@ static void sig_cld(int signum)
while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0)
;
+ /*
+ * Turns out it's *really* important not to
+ * restore the signal handler here if we have real POSIX
+ * signal handling. If we do, then we get the signal re-delivered
+ * immediately - hey presto - instant loop ! JRA.
+ */
+
+#if !defined(HAVE_SIGACTION)
CatchSignal(SIGCLD, sig_cld);
+#endif
}
/****************************************************************************
@@ -40,7 +49,18 @@ catch child exits - leave status;
static void sig_cld_leave_status(int signum)
{
+ /*
+ * Turns out it's *really* important not to
+ * restore the signal handler here if we have real POSIX
+ * signal handling. If we do, then we get the signal re-delivered
+ * immediately - hey presto - instant loop ! JRA.
+ */
+
+#if !defined(HAVE_SIGACTION)
CatchSignal(SIGCLD, sig_cld_leave_status);
+#else
+ ;
+#endif
}
/*******************************************************************
@@ -93,7 +113,7 @@ void CatchSignal(int signum,void (*handler)(int ))
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask,signum);
sigaction(signum,&act,NULL);
-#else
+#else /* !HAVE_SIGACTION */
/* FIXME: need to handle sigvec and systems with broken signal() */
signal(signum, handler);
#endif