Retire old libsrs_alt -based SRS support. Bug 1649
[exim.git] / src / src / child.c
index 3aa6962212e5bf6735d0da901c174d3a74bf8e5e..4a262d623a2d19d40e3896561d22e421480a36ad 100644 (file)
@@ -3,6 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2015 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -26,7 +27,7 @@ Arguments:
 Returns:       nothing
 */
 
-static void
+void
 force_fd(int oldfd, int newfd)
 {
 if (oldfd == newfd) return;
@@ -107,7 +108,22 @@ if (!minimal)
   else
     {
     if (debug_selector != 0)
+      {
       argv[n++] = string_sprintf("-d=0x%x", debug_selector);
+      if (debug_fd > 2)
+       {
+       int flags = fcntl(debug_fd, F_GETFD);
+       if (flags != -1) (void)fcntl(debug_fd, F_SETFD, flags & ~FD_CLOEXEC);
+       close(2);
+       dup2(debug_fd, 2);
+       close(debug_fd);
+       }
+      }
+    }
+  DEBUG(D_any)
+    {
+    argv[n++] = US"-MCd";
+    argv[n++] = US process_purpose;
     }
   if (!f.testsuite_delays) argv[n++] = US"-odd";
   if (f.dont_deliver) argv[n++] = US"-N";
@@ -140,7 +156,7 @@ if (acount > 0)
 argv[n] = NULL;
 if (exec_type == CEE_RETURN_ARGV)
   {
-  if (pcount != NULL) *pcount = n;
+  if (pcount) *pcount = n;
   return argv;
   }
 
@@ -263,6 +279,8 @@ if (pid == 0)
     }
   }
 
+testharness_pause_ms(100); /* let child work even longer, for exec */
+
 /* Parent process. Save fork() errno and close the reading end of the stdin
 pipe. */