summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2004-10-14 14:52:45 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2004-10-14 14:52:45 +0000
commit35af9f61534cba784c1718d804567043da64f2df (patch)
tree0414861ebb3b95a06eb02547ed54c709030c243c /src
parent461f4862f815c93ced69e2551a7bf3691b401add (diff)
Give more explanation in the error message when the command for a transport
filter fails to execute.
Diffstat (limited to 'src')
-rw-r--r--src/src/transport.c37
-rw-r--r--src/src/transports/appendfile.c10
-rw-r--r--src/src/transports/lmtp.c6
-rw-r--r--src/src/transports/pipe.c8
-rw-r--r--src/src/transports/smtp.c7
5 files changed, 41 insertions, 27 deletions
diff --git a/src/src/transport.c b/src/src/transport.c
index 855bedd91..8b6841783 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transport.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transport.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1095,29 +1095,34 @@ if (filter_pid > 0 && (rc = child_close(filter_pid, 30)) != 0 && yield)
}
/* Wait for the writing process to complete. If it ends successfully,
-read the results from its pipe. */
+read the results from its pipe, provided we haven't already had a filter
+process failure. */
DEBUG(D_transport) debug_printf("waiting for writing process\n");
if (write_pid > 0)
{
- if ((rc = child_close(write_pid, 30)) == 0)
+ rc = child_close(write_pid, 30);
+ if (yield)
{
- BOOL ok;
- read(pfd[pipe_read], (void *)&ok, sizeof(BOOL));
- if (!ok)
+ if (rc == 0)
+ {
+ BOOL ok;
+ read(pfd[pipe_read], (void *)&ok, sizeof(BOOL));
+ if (!ok)
+ {
+ read(pfd[pipe_read], (void *)&save_errno, sizeof(int));
+ read(pfd[pipe_read], (void *)&(addr->more_errno), sizeof(int));
+ yield = FALSE;
+ }
+ }
+ else
{
- read(pfd[pipe_read], (void *)&save_errno, sizeof(int));
- read(pfd[pipe_read], (void *)&(addr->more_errno), sizeof(int));
yield = FALSE;
+ save_errno = ERRNO_FILTER_FAIL;
+ addr->more_errno = rc;
+ DEBUG(D_transport) debug_printf("writing process returned %d\n", rc);
}
- }
- else if (yield)
- {
- yield = FALSE;
- save_errno = ERRNO_FILTER_FAIL;
- addr->more_errno = rc;
- DEBUG(D_transport) debug_printf("writing process returned %d\n", rc);
- }
+ }
}
close(pfd[pipe_read]);
diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c
index bdda9047d..8cac73c30 100644
--- a/src/src/transports/appendfile.c
+++ b/src/src/transports/appendfile.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.2 2004/10/11 09:49:43 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.3 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2858,8 +2858,12 @@ if (yield != OK)
from child_close() is in more_errno. */
else if (errno == ERRNO_FILTER_FAIL)
- addr->message = string_sprintf("filter process failure %d while writing "
- "to %s", addr->more_errno, dataname);
+ {
+ yield = PANIC;
+ addr->message = string_sprintf("transport filter process failed (%d) "
+ "while writing to %s%s", addr->more_errno, dataname,
+ (addr->more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
+ }
/* Handle failure to expand header changes */
diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c
index 871f724c0..17b0b8253 100644
--- a/src/src/transports/lmtp.c
+++ b/src/src/transports/lmtp.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/lmtp.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/lmtp.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -141,7 +141,9 @@ end the DATA. */
if (*errno_value == ERRNO_FILTER_FAIL)
{
- *message = string_sprintf("transport filter process failed (%d)", more_errno);
+ *message = string_sprintf("transport filter process failed (%d)%s",
+ more_errno,
+ (more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
return FALSE;
}
diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c
index f2fe47112..d159186ba 100644
--- a/src/src/transports/pipe.c
+++ b/src/src/transports/pipe.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/pipe.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/pipe.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -800,14 +800,16 @@ if (!written_ok)
}
else
{
- addr->transport_return = PANIC;
+ addr->transport_return = PANIC;
addr->basic_errno = errno;
if (errno == ERRNO_CHHEADER_FAIL)
addr->message =
string_sprintf("Failed to expand headers_add or headers_remove: %s",
expand_string_message);
else if (errno == ERRNO_FILTER_FAIL)
- addr->message = string_sprintf("Filter process failure");
+ addr->message = string_sprintf("Transport filter process failed (%d)%s",
+ addr->more_errno,
+ (addr->more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
else if (errno == ERRNO_WRITEINCOMPLETE)
addr->message = string_sprintf("Failed repeatedly to write data");
else
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index 71fca3a10..1a7f84271 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -389,8 +389,9 @@ end the DATA. */
if (*errno_value == ERRNO_FILTER_FAIL)
{
- *message = US string_sprintf("transport filter process failed (%d)",
- more_errno);
+ *message = US string_sprintf("transport filter process failed (%d)%s",
+ more_errno,
+ (more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
return FALSE;
}