summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/process.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 1ec176bd08..c4c1debbf3 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1299,6 +1299,7 @@ static int setup_select_timeout(void)
void check_reload(int t)
{
+ static pid_t mypid = 0;
static time_t last_smb_conf_reload_time = 0;
static time_t last_printer_reload_time = 0;
time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
@@ -1314,6 +1315,15 @@ void check_reload(int t)
last_printer_reload_time = t;
}
+ if (mypid != getpid()) { /* First time or fork happened meanwhile */
+ /* randomize over 60 second the printcap reload to avoid all
+ * process hitting cupsd at the same time */
+ int time_range = 60;
+
+ last_printer_reload_time += random() % time_range;
+ mypid = getpid();
+ }
+
if (reload_after_sighup || (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK)) {
reload_services(True);
reload_after_sighup = False;