Transport filter timeout fix. Fixes: #898
[exim.git] / src / src / transports / pipe.c
index 3021194aed68e8d3687eec2bbaac741a17029098..bbba305b09d95d377239c94ad7794a47d2902a71 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/pipe.c,v 1.12 2007/01/08 10:50:20 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/pipe.c,v 1.13 2009/11/05 19:28:10 nm4 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -924,6 +924,18 @@ if ((rc = child_close(pid, timeout)) != 0)
       "transport: %s%s", tblock->name, strerror(errno), tmsg);
     }
 
+  /* Since the transport_filter timed out we assume it has sent the child process
+  a malformed or incomplete data stream.  Kill off the child process
+  and prevent checking its exit status as it will has probably exited in error.
+  This prevents the transport_filter timeout message from getting overwritten
+  by the exit error which is not the cause of the problem. */
+
+  else if (transport_filter_timed_out)
+    {
+    killpg(pid, SIGKILL);
+    kill(outpid, SIGKILL);
+    }
+
   /* Either the process completed, but yielded a non-zero (necessarily
   positive) status, or the process was terminated by a signal (rc will contain
   the negation of the signal number). Treat killing by signal as failure unless