diff options
author | Volker Lendecke <vl@samba.org> | 2021-04-23 16:09:43 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2021-04-27 13:24:35 +0000 |
commit | ce97c67186266213ef78ccc56917a6bb45bd200d (patch) | |
tree | 620d9eca3039618a49d3ec939f9e623a3f908e9b | |
parent | 7997a090c687df56c29607d4860b306aeb1dd237 (diff) | |
download | samba-ce97c67186266213ef78ccc56917a6bb45bd200d.tar.gz |
printing: Reduce indentation in start_background_queue()
We don't need the "if(pid==0)" here, we've covered "if(pid!=0)" a few
lines above.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | source3/printing/queue_process.c | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index 225b7d8aa89..7d7d53c35d0 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -311,6 +311,8 @@ pid_t start_background_queue(struct tevent_context *ev, { pid_t pid; struct bq_state *state; + int ret; + NTSTATUS status; DEBUG(3,("start_background_queue: Starting background LPQ thread\n")); @@ -332,61 +334,56 @@ pid_t start_background_queue(struct tevent_context *ev, return pid; } - if (pid == 0) { - int ret; - NTSTATUS status; - - /* Child. */ - DEBUG(5,("start_background_queue: background LPQ thread started\n")); + /* Child. */ + DEBUG(5,("start_background_queue: background LPQ thread started\n")); - status = smbd_reinit_after_fork(msg_ctx, ev, true, "lpqd"); + status = smbd_reinit_after_fork(msg_ctx, ev, true, "lpqd"); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("reinit_after_fork() failed\n")); - smb_panic("reinit_after_fork() failed"); - } + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("reinit_after_fork() failed\n")); + smb_panic("reinit_after_fork() failed"); + } - state = talloc_zero(NULL, struct bq_state); - if (state == NULL) { - exit(1); - } - state->ev = ev; - state->msg = msg_ctx; + state = talloc_zero(NULL, struct bq_state); + if (state == NULL) { + exit(1); + } + state->ev = ev; + state->msg = msg_ctx; - bq_reopen_logs(logfile); - bq_setup_sig_term_handler(); - bq_setup_sig_hup_handler(state); - bq_setup_sig_chld_handler(ev); + bq_reopen_logs(logfile); + bq_setup_sig_term_handler(); + bq_setup_sig_hup_handler(state); + bq_setup_sig_chld_handler(ev); - BlockSignals(false, SIGTERM); - BlockSignals(false, SIGHUP); + BlockSignals(false, SIGTERM); + BlockSignals(false, SIGHUP); - if (!printing_subsystem_queue_tasks(state)) { - exit(1); - } + if (!printing_subsystem_queue_tasks(state)) { + exit(1); + } - if (!locking_init()) { - exit(1); - } - messaging_register(msg_ctx, state, MSG_SMB_CONF_UPDATED, - bq_smb_conf_updated); - messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE, - print_queue_receive); - /* Remove previous forwarder message set in parent. */ - messaging_deregister(msg_ctx, MSG_PRINTER_DRVUPGRADE, NULL); - - messaging_register(msg_ctx, NULL, MSG_PRINTER_DRVUPGRADE, - do_drv_upgrade_printer); - - pcap_cache_reload(ev, msg_ctx, reload_pcap_change_notify); - - DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); - ret = tevent_loop_wait(ev); - /* should not be reached */ - DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n", - ret, (ret == 0) ? "out of events" : strerror(errno))); + if (!locking_init()) { exit(1); } + messaging_register(msg_ctx, state, MSG_SMB_CONF_UPDATED, + bq_smb_conf_updated); + messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE, + print_queue_receive); + /* Remove previous forwarder message set in parent. */ + messaging_deregister(msg_ctx, MSG_PRINTER_DRVUPGRADE, NULL); + + messaging_register(msg_ctx, NULL, MSG_PRINTER_DRVUPGRADE, + do_drv_upgrade_printer); + + pcap_cache_reload(ev, msg_ctx, reload_pcap_change_notify); + + DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); + ret = tevent_loop_wait(ev); + /* should not be reached */ + DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n", + ret, (ret == 0) ? "out of events" : strerror(errno))); + exit(1); return pid; } |