summaryrefslogtreecommitdiffstats
path: root/source/smbd/server.c
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
commit4d26757776af2aaba9cdaf4c956fab29bfde1599 (patch)
tree2f991e60be61b8d724c225dac3aad318f2b22a2d /source/smbd/server.c
parentcf7402c5325afd1f9a737facf285cb905702adb2 (diff)
downloadsamba-4d26757776af2aaba9cdaf4c956fab29bfde1599.tar.gz
samba-4d26757776af2aaba9cdaf4c956fab29bfde1599.tar.xz
samba-4d26757776af2aaba9cdaf4c956fab29bfde1599.zip
Needed fix to SIGHUP handling donated by branko.cibej@hermes.si
(I can't believe we've had that bug so long :-). Jeremy.
Diffstat (limited to 'source/smbd/server.c')
-rw-r--r--source/smbd/server.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 45a63a544ab..300e8d28e80 100644
--- a/source/smbd/server.c
+++ b/source/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)
{