(1) Don't ignore timeouts while writing to a pipe! (As opposed to
[exim.git] / src / src / transport.c
index 610b0904b768cadd8157327d2c50bec9f42d8824..c388187700d5aa1d55bdc77c0d9f0a9774836e5a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transport.c,v 1.6 2005/03/08 16:57:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transport.c,v 1.8 2005/05/03 14:20:01 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -797,7 +797,10 @@ if ((options & topt_no_headers) == 0)
   same alias might share some of them) but we want to output them in the
   opposite order. This is a bit tedious, but there shouldn't be very many
   of them. We just walk the list twice, reversing the pointers each time,
-  but on the second time, write out the items. */
+  but on the second time, write out the items.
+
+  Headers added to an address by a router are guaranteed to end with a newline.
+  */
 
   if (addr != NULL)
     {
@@ -824,7 +827,8 @@ if ((options & topt_no_headers) == 0)
   /* If a string containing additional headers exists, expand it and write
   out the result. This is done last so that if it (deliberately or accidentally)
   isn't in header format, it won't mess up any other headers. An empty string
-  or a forced expansion failure are noops. */
+  or a forced expansion failure are noops. An added header string from a
+  transport may not end with a newline; add one if it does not. */
 
   if (add_headers != NULL)
     {
@@ -846,7 +850,11 @@ if ((options & topt_no_headers) == 0)
         if (s[len-1] != '\n' && !write_chunk(fd, US"\n", 1, use_crlf))
           return FALSE;
         DEBUG(D_transport)
-          debug_printf("added header line(s):\n%s---\n", s);
+          {
+          debug_printf("added header line(s):\n%s", s);
+          if (s[len-1] != '\n') debug_printf("\n");
+          debug_printf("---\n");
+          }
         }
       }
     }
@@ -1091,6 +1099,8 @@ int rc, len, yield, fd_read, fd_write, save_errno;
 int pfd[2];
 pid_t filter_pid, write_pid;
 
+transport_filter_timed_out = FALSE;
+
 /* If there is no filter command set up, call the internal function that does
 the actual work, passing it the incoming fd, and return its result. */
 
@@ -1203,6 +1213,7 @@ for (;;)
   if (sigalrm_seen)
     {
     errno = ETIMEDOUT;
+    transport_filter_timed_out = TRUE;
     goto TIDY_UP;
     }