From 769269c384f49533e335969cff0f740f8148b6ff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Jul 1998 22:01:51 +0000 Subject: Needed fix to SIGHUP handling donated by branko.cibej@hermes.si (I can't believe we've had that bug so long :-). Jeremy. (This used to be commit 4d26757776af2aaba9cdaf4c956fab29bfde1599) --- source3/smbd/server.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'source3') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 45a63a544a..300e8d28e8 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -3484,15 +3484,15 @@ BOOL reload_services(BOOL test) BOOL ret; if (lp_loaded()) + { + pstring fname; + pstrcpy(fname,lp_configfile()); + if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) { - pstring fname; - pstrcpy(fname,lp_configfile()); - if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) - { - pstrcpy(servicesf,fname); - test = False; - } + pstrcpy(servicesf,fname); + test = False; } + } reopen_logs(); @@ -3532,11 +3532,20 @@ BOOL reload_services(BOOL test) /**************************************************************************** this prevents zombie child processes ****************************************************************************/ +static BOOL reload_after_sighup = False; + static int sig_hup(void) { BlockSignals(True,SIGHUP); DEBUG(0,("Got SIGHUP\n")); - reload_services(False); + + /* + * Fix from here. + * We used to reload in the signal handler - this + * is a *BIG* no-no. + */ + + reload_after_sighup = True; #ifndef DONT_REINSTALL_SIG signal(SIGHUP,SIGNAL_CAST sig_hup); #endif @@ -5117,6 +5126,18 @@ static void process(void) reload_services(True); } + /* + * If reload_after_sighup == True then we got a SIGHUP + * and are being asked to reload. Fix from + */ + + if (reload_after_sighup) + { + DEBUG(0,("Reloading services after SIGHUP\n")); + reload_services(False); + reload_after_sighup = False; + } + /* automatic timeout if all connections are closed */ if (num_connections_open==0 && counter >= IDLE_CLOSED_TIMEOUT) { -- cgit