Fix 2-phase, in-order queue run delivery order
[exim.git] / src / src / daemon.c
index 3c63c63681a24b15d59b90ccc3257c1a6a20cd38..16137f9f61fbb62ee693a63fa9940c6a7764bae3 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2023 */
+/* Copyright (c) The Exim Maintainers 2020 - 2024 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
@@ -311,7 +311,7 @@ if (smtp_accept_max_per_host)
   /* For speed, interpret a decimal number inline here */
   else
     {
-    uschar *s = expanded;
+    uschar * s = expanded;
     while (isdigit(*s))
       max_for_this_host = max_for_this_host * 10 + *s++ - '0';
     if (*s)
@@ -320,9 +320,9 @@ if (smtp_accept_max_per_host)
     }
   }
 
-/* If we have fewer connections than max_for_this_host, we can skip the tedious
-per host_address checks. Note that at this stage smtp_accept_count contains the
-count of *other* connections, not including this one. */
+/* If we have fewer total connections than max_for_this_host, we can skip the
+tedious per host_address checks. Note that at this stage smtp_accept_count
+contains the count of *other* connections, not including this one. */
 
 if (max_for_this_host > 0 && smtp_accept_count >= max_for_this_host)
   {
@@ -920,7 +920,7 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
         smtp_slots[i] = empty_smtp_slot;
         if (--smtp_accept_count < 0) smtp_accept_count = 0;
         DEBUG(D_any) debug_printf("%d SMTP accept process%s now running\n",
-          smtp_accept_count, (smtp_accept_count == 1)? "" : "es");
+          smtp_accept_count, smtp_accept_count == 1 ? "" : "es");
         break;
         }
     if (i < smtp_accept_max) continue;  /* Found an accepting process */
@@ -1493,7 +1493,7 @@ if (is_multiple_qrun())                           /* we are managing periodic runs */
       }
     else
 #endif
-      /* Normal periodic runL in order of run priority, find the first queue
+      /* Normal periodic run: in order of run priority, find the first queue
       for which we can start a runner */
 
       for (q = qrunners; q; q = q->next)
@@ -2157,7 +2157,7 @@ if (f.background_daemon)
     pid_t pid = exim_fork(US"daemon");
     if (pid < 0) log_write(0, LOG_MAIN|LOG_PANIC_DIE,
       "fork() failed when starting daemon: %s", strerror(errno));
-    if (pid > 0) exit(EXIT_SUCCESS);      /* in parent process, just exit */
+    if (pid > 0) exim_exit(EXIT_SUCCESS); /* in parent process, just exit */
     (void)setsid();                       /* release controlling terminal */
     f.daemon_listen = daemon_listen;
     }