summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-07-09 22:01:51 +0000
committerJeremy Allison <jra@samba.org>1998-07-09 22:01:51 +0000
commit769269c384f49533e335969cff0f740f8148b6ff (patch)
treed15e558ec6bd0451036bf90f4a50d5f60675ef77 /source3/smbd
parent86de50535f66c8ad51374b19fedb0377060ac8ba (diff)
downloadsamba-769269c384f49533e335969cff0f740f8148b6ff.tar.gz
samba-769269c384f49533e335969cff0f740f8148b6ff.tar.bz2
samba-769269c384f49533e335969cff0f740f8148b6ff.zip
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)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/server.c37
1 files changed, 29 insertions, 8 deletions
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 <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)
{