printing: Reduce indentation in start_background_queue()
authorVolker Lendecke <vl@samba.org>
Fri, 23 Apr 2021 14:09:43 +0000 (16:09 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 27 Apr 2021 13:24:35 +0000 (13:24 +0000)
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>
source3/printing/queue_process.c

index 225b7d8aa8924d0e3c9166032a3c8ba7b7b88802..7d7d53c35d03414da62057bc34b9d6ad019c4356 100644 (file)
@@ -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;
 }