[25688] in CVS-changelog-for-Kerberos-V5
svn rev #25177: trunk/src/kdc/
daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Wed Sep 14 12:14:38 2011
Date: Wed, 14 Sep 2011 12:12:36 -0400
From: ghudson@mit.edu
Message-Id: <201109141612.p8EGCaMP024644@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
http://src.mit.edu/fisheye/changelog/krb5/?cs=25177
Commit By: ghudson
Log Message:
Set up monitor signal handlers before forking.
This avoids a race condition where a child reports "starting..." and
begins to service requests before the monitor is ready to handle
termination signals. Really only an issue for the test suite. From
npmccallum@redhat.com.
Changed Files:
U trunk/src/kdc/main.c
Modified: trunk/src/kdc/main.c
===================================================================
--- trunk/src/kdc/main.c 2011-09-14 16:12:33 UTC (rev 25176)
+++ trunk/src/kdc/main.c 2011-09-14 16:12:36 UTC (rev 25177)
@@ -543,6 +543,26 @@
struct sigaction s_action;
#endif /* POSIX_SIGNALS */
+ /*
+ * Setup our signal handlers which will forward to the children.
+ * These handlers will be overriden in the child processes.
+ */
+#ifdef POSIX_SIGNALS
+ (void) sigemptyset(&s_action.sa_mask);
+ s_action.sa_flags = 0;
+ s_action.sa_handler = on_monitor_signal;
+ (void) sigaction(SIGINT, &s_action, (struct sigaction *) NULL);
+ (void) sigaction(SIGTERM, &s_action, (struct sigaction *) NULL);
+ (void) sigaction(SIGQUIT, &s_action, (struct sigaction *) NULL);
+ s_action.sa_handler = on_monitor_sighup;
+ (void) sigaction(SIGHUP, &s_action, (struct sigaction *) NULL);
+#else /* POSIX_SIGNALS */
+ signal(SIGINT, on_monitor_signal);
+ signal(SIGTERM, on_monitor_signal);
+ signal(SIGQUIT, on_monitor_signal);
+ signal(SIGHUP, on_monitor_sighup);
+#endif /* POSIX_SIGNALS */
+
/* Create child worker processes; return in each child. */
krb5_klog_syslog(LOG_INFO, _("creating %d worker processes"), num);
pids = calloc(num, sizeof(pid_t));
@@ -580,23 +600,6 @@
/* We're going to use our own main loop here. */
loop_free(ctx);
- /* Setup our signal handlers which will forward to the children. */
-#ifdef POSIX_SIGNALS
- (void) sigemptyset(&s_action.sa_mask);
- s_action.sa_flags = 0;
- s_action.sa_handler = on_monitor_signal;
- (void) sigaction(SIGINT, &s_action, (struct sigaction *) NULL);
- (void) sigaction(SIGTERM, &s_action, (struct sigaction *) NULL);
- (void) sigaction(SIGQUIT, &s_action, (struct sigaction *) NULL);
- s_action.sa_handler = on_monitor_sighup;
- (void) sigaction(SIGHUP, &s_action, (struct sigaction *) NULL);
-#else /* POSIX_SIGNALS */
- signal(SIGINT, on_monitor_signal);
- signal(SIGTERM, on_monitor_signal);
- signal(SIGQUIT, on_monitor_signal);
- signal(SIGHUP, on_monitor_sighup);
-#endif /* POSIX_SIGNALS */
-
/* Supervise the worker processes. */
numleft = num;
while (!signal_received) {
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5