From 131e7c54c417828b2a15a3d2f33709bdc3335d47 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 13 Sep 2002 06:49:28 +0000 Subject: Better error return reporting from the MDA. svn path=/trunk/; revision=3713 --- sink.c | 21 +++++++++++++++++++-- 1 file 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 #include +/* for W* macros after pclose() */ +#define _USE_BSD +#include +#include +#include +#include + + #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); } } -- cgit v1.2.3