summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-06-05 01:59:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:08 -0500
commit0ff54fb41db4841fa72ac74361e9dd602a47418f (patch)
tree40b9f4a4f7457acbf67fad34ea2612829140a827 /source3/nmbd
parentcff8d01a41b4b26c25d88b77e7c3716ec49656ce (diff)
downloadsamba-0ff54fb41db4841fa72ac74361e9dd602a47418f.tar.gz
samba-0ff54fb41db4841fa72ac74361e9dd602a47418f.tar.bz2
samba-0ff54fb41db4841fa72ac74361e9dd602a47418f.zip
r23349: Fix from Steve Langasek <vorlon@debian.org> to
allow SIGTERM to cause nmbd to exit on awaiting an interface to come up. Debian bug #168079 Jeremy. (This used to be commit 9ee310f3d68426da552f084ebcffef6b8ebbf612)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_subnetdb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 4b04751235..398119cc82 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -185,12 +185,28 @@ BOOL create_subnets(void)
struct in_addr unicast_ip, ipzero;
if(num_interfaces == 0) {
+ void (*saved_handler)(int);
+
DEBUG(0,("create_subnets: No local interfaces !\n"));
DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
+
+ /*
+ * Whilst we're waiting for an interface, allow SIGTERM to
+ * cause us to exit.
+ */
+
+ saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
+
while (iface_count() == 0) {
sleep(5);
load_interfaces();
}
+
+ /*
+ * We got an interface, restore our normal term handler.
+ */
+
+ CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
}
num_interfaces = iface_count();