git.samba.org
/
metze
/
samba
/
wip.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
s3:nmbd: as the sig_term() handler only sets a flag we don't need to block SIGTERM
[metze/samba/wip.git]
/
source3
/
nmbd
/
nmbd.c
diff --git
a/source3/nmbd/nmbd.c
b/source3/nmbd/nmbd.c
index 28de212d694b772b7c4deb00a6966ef68384cb09..1b26c0a5ada8e01878141ab2b584b1fce12e1fb4 100644
(file)
--- a/
source3/nmbd/nmbd.c
+++ b/
source3/nmbd/nmbd.c
@@
-219,7
+219,7
@@
static void reload_interfaces(time_t t)
* ignore it here. JRA.
*/
* ignore it here. JRA.
*/
- if (is_loopback_addr(&iface->ip)) {
+ if (is_loopback_addr(
(struct sockaddr *)
&iface->ip)) {
DEBUG(2,("reload_interfaces: Ignoring loopback "
"interface %s\n",
print_sockaddr(str, sizeof(str), &iface->ip) ));
DEBUG(2,("reload_interfaces: Ignoring loopback "
"interface %s\n",
print_sockaddr(str, sizeof(str), &iface->ip) ));
@@
-282,6
+282,7
@@
static void reload_interfaces(time_t t)
/* We need to wait if there are no subnets... */
if (FIRST_SUBNET == NULL) {
/* 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: "
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.
*/
* 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. */
/* 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();
}
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.
*/
/*
* We got an interface, go back to blocking term.
*/
- BlockSignals(true, SIGTERM);
goto try_again;
}
}
goto try_again;
}
}
@@
-397,7
+389,7
@@
static void msg_nmbd_send_packet(struct messaging_context *msg,
}
in_addr_to_sockaddr_storage(&ss, p->ip);
}
in_addr_to_sockaddr_storage(&ss, p->ip);
- pss = iface_ip(&ss);
+ pss = iface_ip(
(struct sockaddr *)
&ss);
if (pss == NULL) {
DEBUG(2, ("Could not find ip for packet from %d\n",
if (pss == NULL) {
DEBUG(2, ("Could not find ip for packet from %d\n",
@@
-441,10
+433,6
@@
static void process(void)
time_t t = time(NULL);
TALLOC_CTX *frame = talloc_stackframe();
time_t t = time(NULL);
TALLOC_CTX *frame = talloc_stackframe();
- /* Check for internal messages */
-
- message_dispatch(nmbd_messaging_context());
-
/*
* Check all broadcast subnets to see if
* we need to run an election on any of them.
/*
* Check all broadcast subnets to see if
* we need to run an election on any of them.
@@
-803,12
+791,12
@@
static bool open_sockets(bool isdaemon, int port)
sys_srandom(time(NULL) ^ sys_getpid());
if (!override_logfile) {
sys_srandom(time(NULL) ^ sys_getpid());
if (!override_logfile) {
- char *l
og
file = NULL;
- if (asprintf(&l
og
file, "%s/log.nmbd", get_dyn_LOGFILEBASE()) < 0) {
+ char *lfile = NULL;
+ if (asprintf(&lfile, "%s/log.nmbd", get_dyn_LOGFILEBASE()) < 0) {
exit(1);
}
exit(1);
}
- lp_set_logfile(l
og
file);
- SAFE_FREE(l
og
file);
+ lp_set_logfile(lfile);
+ SAFE_FREE(lfile);
}
fault_setup((void (*)(void *))fault_continue );
}
fault_setup((void (*)(void *))fault_continue );
@@
-847,7
+835,7
@@
static bool open_sockets(bool isdaemon, int port)
reopen_logs();
reopen_logs();
- DEBUG(0,("nmbd version %s started.\n",
SAMBA_VERSION_STRING
));
+ DEBUG(0,("nmbd version %s started.\n",
samba_version_string()
));
DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
@@
-911,7
+899,8
@@
static bool open_sockets(bool isdaemon, int port)
pidfile_create("nmbd");
pidfile_create("nmbd");
- if (!reinit_after_fork(nmbd_messaging_context(), false)) {
+ if (!reinit_after_fork(nmbd_messaging_context(),
+ nmbd_event_context(), false)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
@@
-980,9
+969,6
@@
static bool open_sockets(bool isdaemon, int port)
exit(1);
}
exit(1);
}
- /* We can only take signals in the select. */
- BlockSignals( True, SIGTERM );
-
TALLOC_FREE(frame);
process();
TALLOC_FREE(frame);
process();