summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-09 16:44:52 -0400
committerAndreas Schneider <asn@samba.org>2011-08-10 18:14:05 +0200
commit7a071625581af876f8fd73b35a70eccd0d838208 (patch)
tree3bff5dd01764fef08a856c17ab5385a8c1b885de /source3/printing
parentf00681fe9a78e5c0b02daff2fd83a568f8d95eff (diff)
downloadsamba-7a071625581af876f8fd73b35a70eccd0d838208.tar.gz
samba-7a071625581af876f8fd73b35a70eccd0d838208.tar.bz2
samba-7a071625581af876f8fd73b35a70eccd0d838208.zip
s3-prefork: Fix use of child id.
Children Ids must start at 1 as 0 represent the father. Also fix callbacks that restart logs to use a procedd global variable that holds the Id so that they work correctly both fot the parent process and the children. Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/spoolssd.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 4379179f02..ed529888f8 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -51,6 +51,7 @@ static int spoolss_min_children;
static int spoolss_max_children;
static int spoolss_spawn_rate;
static int spoolss_prefork_status;
+static int spoolss_child_id = 0;
static void spoolss_prefork_config(void)
{
@@ -147,8 +148,10 @@ static void update_conf(struct tevent_context *ev,
lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
reload_printers(ev, msg);
- spoolss_reopen_logs(0);
- spoolss_prefork_config();
+ spoolss_reopen_logs(spoolss_child_id);
+ if (spoolss_child_id == 0) {
+ spoolss_prefork_config();
+ }
}
static void smb_conf_updated(struct messaging_context *msg,
@@ -243,7 +246,6 @@ static bool spoolss_shutdown_cb(void *ptr)
struct spoolss_chld_sig_hup_ctx {
struct messaging_context *msg_ctx;
struct pf_worker_data *pf;
- int child_id;
};
static void spoolss_chld_sig_hup_handler(struct tevent_context *ev,
@@ -266,13 +268,12 @@ static void spoolss_chld_sig_hup_handler(struct tevent_context *ev,
change_to_root_user();
DEBUG(1,("Reloading printers after SIGHUP\n"));
reload_printers(ev, shc->msg_ctx);
- spoolss_reopen_logs(shc->child_id);
+ spoolss_reopen_logs(spoolss_child_id);
}
static bool spoolss_setup_chld_hup_handler(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
- struct pf_worker_data *pf,
- int child_id)
+ struct pf_worker_data *pf)
{
struct spoolss_chld_sig_hup_ctx *shc;
struct tevent_signal *se;
@@ -282,7 +283,6 @@ static bool spoolss_setup_chld_hup_handler(struct tevent_context *ev_ctx,
DEBUG(1, ("failed to setup SIGHUP handler"));
return false;
}
- shc->child_id = child_id;
shc->pf = pf;
shc->msg_ctx = msg_ctx;
@@ -314,9 +314,10 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
smb_panic("reinit_after_fork() failed");
}
+ spoolss_child_id = child_id;
spoolss_reopen_logs(child_id);
- ok = spoolss_setup_chld_hup_handler(ev_ctx, msg_ctx, pf, child_id);
+ ok = spoolss_setup_chld_hup_handler(ev_ctx, msg_ctx, pf);
if (!ok) {
return false;
}
@@ -359,7 +360,6 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
struct spoolss_children_data {
struct tevent_context *ev_ctx;
struct messaging_context *msg_ctx;
- int child_id;
struct pf_worker_data *pf;
int listen_fd_size;
int *listen_fds;
@@ -392,7 +392,6 @@ static int spoolss_children_main(struct tevent_context *ev_ctx,
if (!data) {
return 1;
}
- data->child_id = child_id;
data->pf = pf;
data->ev_ctx = ev_ctx;
data->msg_ctx = msg_ctx;