diff options
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/nmbd.c | 21 | ||||
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 19 |
2 files changed, 37 insertions, 3 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index da98fbfde3..744942ba46 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -75,11 +75,11 @@ static int sig_term() announce_my_servers_removed(); exit(0); + /* Keep compiler happy.. */ return 0; } /* sig_term */ - /**************************************************************************** ** catch a sighup **************************************************************************** */ @@ -577,6 +577,17 @@ int main(int argc,char *argv[]) signal( SIGHUP, SIGNAL_CAST sig_hup ); signal( SIGTERM, SIGNAL_CAST sig_term ); + /* Setup the signals that allow the debug log level + to by dynamically changed. */ + +#if defined(SIGUSR1) + signal( SIGUSR1, SIGNAL_CAST sig_usr1 ); +#endif /* SIGUSR1 */ + +#if defined(SIGUSR2) + signal( SIGUSR2, SIGNAL_CAST sig_usr2 ); +#endif /* SIGUSR2 */ + while((opt = getopt(argc, argv, "as:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:f:")) != EOF) { switch (opt) @@ -755,8 +766,14 @@ int main(int argc,char *argv[]) exit(1); } - /* We can only take sigterm signals in the select. */ + /* We can only take signals in the select. */ BlockSignals( True, SIGTERM ); +#if defined(SIGUSR1) + BlockSignals( True, SIGUSR1); +#endif /* SIGUSR1 */ +#if defined(SIGUSR2) + BlockSignals( True, SIGUSR2); +#endif /* SIGUSR2 */ process(); close_sockets(); diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 4fb0543967..03bd3889fa 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1650,10 +1650,27 @@ BOOL listen_for_packets(BOOL run_election) timeout.tv_sec = (run_election||num_response_packets) ? 1 : NMBD_SELECT_LOOP; timeout.tv_usec = 0; - /* We can only take term signals when we are in the select. */ + /* Prepare for the select - allow certain signals. */ + BlockSignals(False, SIGTERM); +#if defined(SIGUSR1) + BlockSignals(False, SIGUSR1); +#endif /* SIGUSR1 */ +#if defined(SIGUSR2) + BlockSignals(False, SIGUSR2); +#endif /* SIGUSR2 */ + selrtn = sys_select(&fds,&timeout); + + /* We can only take signals when we are in the select - block them again here. */ + BlockSignals(True, SIGTERM); +#if defined(SIGUSR1) + BlockSignals(True, SIGUSR1); +#endif /* SIGUSR1 */ +#if defined(SIGUSR2) + BlockSignals(True, SIGUSR2); +#endif /* SIGUSR2 */ if(selrtn > 0) { |