svn commit: samba r18360 - in branches/SAMBA_4_0/source/smbd: .

tridge at samba.org tridge at samba.org
Mon Sep 11 04:47:56 GMT 2006


Author: tridge
Date: 2006-09-11 04:47:56 +0000 (Mon, 11 Sep 2006)
New Revision: 18360

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18360

Log:

better handling of child process killing in standard mode

Modified:
   branches/SAMBA_4_0/source/smbd/server.c


Changeset:
Modified: branches/SAMBA_4_0/source/smbd/server.c
===================================================================
--- branches/SAMBA_4_0/source/smbd/server.c	2006-09-11 04:47:48 UTC (rev 18359)
+++ branches/SAMBA_4_0/source/smbd/server.c	2006-09-11 04:47:56 UTC (rev 18360)
@@ -103,6 +103,19 @@
 	debug_schedule_reopen_logs();
 }
 
+static void sig_term(int sig)
+{
+#if HAVE_GETPGRP
+	static int done_sigterm;
+	if (done_sigterm == 0 && getpgrp() == getpid()) {
+		DEBUG(0,("SIGTERM: killing children\n"));
+		done_sigterm = 1;
+		kill(-getpgrp(), SIGTERM);
+	}
+#endif
+	exit(0);
+}
+
 /*
   setup signal masks
 */
@@ -130,6 +143,7 @@
 	BlockSignals(False, SIGTERM);
 
 	CatchSignal(SIGHUP, sig_hup);
+	CatchSignal(SIGTERM, sig_term);
 }
 
 /*
@@ -142,6 +156,11 @@
 	uint8_t c;
 	if (read(0, &c, 1) == 0) {
 		DEBUG(0,("%s: EOF on stdin - terminating\n", binary_name));
+#if HAVE_GETPGRP
+		if (getpgrp() == getpid()) {
+			kill(-getpgrp(), SIGTERM);
+		}
+#endif
 		exit(0);
 	}
 }



More information about the samba-cvs mailing list