From a4188aaf7b415a2da7559e7b58a57f8af399d08e Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 18 Aug 2011 10:39:13 -0400 Subject: 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 Signed-off-by: Simo Sorce --- source3/printing/spoolssd.c | 28 ++++------------------------ 1 file 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; -- cgit