summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-23 10:13:29 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-27 15:28:08 +0100
commite663df195c2a6c108e90273b8fa9831abdbc3b1c (patch)
tree10c74edb2a5430f20160491ce979d524358d0ab1 /source3
parente6612c99fe6c2cb87f09dbc76d077bed789a592d (diff)
downloadsamba-e663df195c2a6c108e90273b8fa9831abdbc3b1c.tar.gz
samba-e663df195c2a6c108e90273b8fa9831abdbc3b1c.tar.bz2
samba-e663df195c2a6c108e90273b8fa9831abdbc3b1c.zip
s3:nmbd: install the SIG_DFL handler for SIGTERM while we're waiting for interfaces
We should handle all 3 cases where we actively wait for interfaces in the same way. metze
Diffstat (limited to 'source3')
-rw-r--r--source3/nmbd/nmbd.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 0922e455a3..870b9a1f30 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -282,6 +282,7 @@ static void reload_interfaces(time_t t)
/* We need to wait if there are no subnets... */
if (FIRST_SUBNET == NULL) {
+ void (*saved_handler)(int);
if (print_waiting_msg) {
DEBUG(0,("reload_interfaces: "
@@ -293,29 +294,20 @@ static void reload_interfaces(time_t t)
* Whilst we're waiting for an interface, allow SIGTERM to
* cause us to exit.
*/
-
- BlockSignals(false, SIGTERM);
+ saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
/* We only count IPv4, non-loopback interfaces here. */
- while (iface_count_v4_nl() == 0 && !got_sig_term) {
+ while (iface_count_v4_nl() == 0) {
sleep(5);
load_interfaces();
}
- /*
- * Handle termination inband.
- */
-
- if (got_sig_term) {
- got_sig_term = 0;
- terminate();
- }
+ CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
/*
* We got an interface, go back to blocking term.
*/
- BlockSignals(true, SIGTERM);
goto try_again;
}
}