1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

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)
This commit is contained in:
Jeremy Allison 1998-07-09 22:01:51 +00:00
parent 86de50535f
commit 769269c384

View File

@ -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 <branko.cibej@hermes.si> 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 <branko.cibej@hermes.si>
*/
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)
{