aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-09-13 06:49:28 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-09-13 06:49:28 +0000
commit131e7c54c417828b2a15a3d2f33709bdc3335d47 (patch)
tree8eb68537ab3237df507f013b8a5af184ab5f2f36
parent1d72e50456b06d53bcdec968d7295c76471bd204 (diff)
downloadfetchmail-131e7c54c417828b2a15a3d2f33709bdc3335d47.tar.gz
fetchmail-131e7c54c417828b2a15a3d2f33709bdc3335d47.tar.bz2
fetchmail-131e7c54c417828b2a15a3d2f33709bdc3335d47.zip
Better error return reporting from the MDA.
svn path=/trunk/; revision=3713
-rw-r--r--sink.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sink.c b/sink.c
index 3595aa85..a906fde7 100644
--- a/sink.c
+++ b/sink.c
@@ -33,6 +33,14 @@
#include <ctype.h>
#include <time.h>
+/* for W* macros after pclose() */
+#define _USE_BSD
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+
+
#include "fetchmail.h"
#include "socket.h"
#include "smtp.h"
@@ -1246,8 +1254,17 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward)
if (rc)
{
- report(stderr,
- GT_("MDA returned nonzero status %d\n"), rc);
+ if (WIFSIGNALED(rc)) {
+ report(stderr,
+ GT_("MDA died of signal %d\n"), WTERMSIG(rc));
+ } else if (WIFEXITED(rc)) {
+ report(stderr,
+ GT_("MDA returned nonzero status %d\n"), WEXITSTATUS(rc));
+ } else {
+ report(stderr,
+ GT_("Strange: MDA pclose returned %d, cannot handle at %s:%d\n"), rc, __FILE__, __LINE__);
+ }
+
return(FALSE);
}
}