summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-18 10:39:13 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:06 -0400
commita4188aaf7b415a2da7559e7b58a57f8af399d08e (patch)
tree076961d3e322cbbe1746d8d4b71c4943b3319288
parent2c459546221863c960ef49c0ab8f406bad792351 (diff)
downloadsamba-a4188aaf7b415a2da7559e7b58a57f8af399d08e.tar.gz
samba-a4188aaf7b415a2da7559e7b58a57f8af399d08e.tar.bz2
samba-a4188aaf7b415a2da7559e7b58a57f8af399d08e.zip
s3-spoolss: Remove useless check
If we *really* are a bout to exit (PF_WORKER_EXITING) then the event will not be called as the loop will exit. Otherwise PF_SRV_MSG_EXIT may not be honoured for a long time if we have cients connected, therefore keep handling SIGHUP properly in those cases. Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
-rw-r--r--source3/printing/spoolssd.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 9a806f09a8..56b283ccdd 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -224,11 +224,6 @@ static bool spoolss_shutdown_cb(void *ptr)
/* Children */
-struct spoolss_chld_sig_hup_ctx {
- struct messaging_context *msg_ctx;
- struct pf_worker_data *pf;
-};
-
static void spoolss_chld_sig_hup_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
@@ -236,19 +231,13 @@ static void spoolss_chld_sig_hup_handler(struct tevent_context *ev,
void *siginfo,
void *pvt)
{
- struct spoolss_chld_sig_hup_ctx *shc;
-
- shc = talloc_get_type_abort(pvt, struct spoolss_chld_sig_hup_ctx);
+ struct messaging_context *msg_ctx;
- /* avoid wasting CPU cycles if we are going to exit soon anyways */
- if (shc->pf != NULL &&
- shc->pf->cmds == PF_SRV_MSG_EXIT) {
- return;
- }
+ msg_ctx = talloc_get_type_abort(pvt, struct messaging_context);
change_to_root_user();
DEBUG(1,("Reloading printers after SIGHUP\n"));
- reload_printers(ev, shc->msg_ctx);
+ reload_printers(ev, msg_ctx);
spoolss_reopen_logs(spoolss_child_id);
}
@@ -256,22 +245,13 @@ static bool spoolss_setup_chld_hup_handler(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
struct pf_worker_data *pf)
{
- struct spoolss_chld_sig_hup_ctx *shc;
struct tevent_signal *se;
- shc = talloc(ev_ctx, struct spoolss_chld_sig_hup_ctx);
- if (!shc) {
- DEBUG(1, ("failed to setup SIGHUP handler"));
- return false;
- }
- shc->pf = pf;
- shc->msg_ctx = msg_ctx;
-
se = tevent_add_signal(ev_ctx,
ev_ctx,
SIGHUP, 0,
spoolss_chld_sig_hup_handler,
- shc);
+ msg_ctx);
if (!se) {
DEBUG(1, ("failed to setup SIGHUP handler"));
return false;