aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--fetchmail.c12
-rw-r--r--fetchmail.man5
3 files changed, 14 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index c74e505c..75c80163 100644
--- a/NEWS
+++ b/NEWS
@@ -6,10 +6,6 @@
Features To Consider
-* It would be nice to be able to have the '-c' and standard retrieval modes
- return a zero exit status if *any* host had mail, not just the last one
- checked.
-
* Generate bounce messages when delivery is refused. See RFC1891, RFC1894.
* More log levels?
@@ -30,8 +26,9 @@ And about time, too, I've been hacking on this code for a year now!
* Leif Erlingsson <leif@lege.com> sent a patch to avoid colliding with
the busy-lock after authentication failure on a POP3 server.
* Allow duplicate server hostnames again.
+* Fetchmail now returns 0 if *any* poll during the run succeeded.
-There are 252 people on the fetchmail-friends list.
+There are 249 people on the fetchmail-friends list.
------------------------------------------------------------------------------
pl 3.9.9 (Wed Jun 25 11:01:51 EDT 1997):
diff --git a/fetchmail.c b/fetchmail.c
index 86f7e15d..8b0bf462 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -69,6 +69,7 @@ char *program_name; /* the name to prefix error messages with */
static char *lockfile; /* name of lockfile */
static int querystatus; /* status of query */
+static int successes; /* count number of successful polls */
static int lastsig; /* last signal received */
static void termhook(); /* forward declaration of exit hook */
@@ -389,6 +390,10 @@ int main (int argc, char **argv)
#endif /* HAVE_GETHOSTBYNAME */
querystatus = query_host(ctl);
+
+ if (querystatus == PS_SUCCESS)
+ successes++;
+
if (!check_only)
update_str_lists(ctl);
#ifdef linux
@@ -478,10 +483,11 @@ int main (int argc, char **argv)
(poll_interval);
if (outlevel == O_VERBOSE)
- fprintf(stderr,"fetchmail: normal termination, status %d\n",querystatus);
+ fprintf(stderr,"fetchmail: normal termination, status %d\n",
+ successes ? PS_SUCCESS : querystatus);
termhook(0);
- exit(querystatus);
+ exit(successes ? PS_SUCCESS : querystatus);
}
static int load_params(int argc, char **argv, int optind)
@@ -673,7 +679,7 @@ void termhook(int sig)
if (!check_only)
write_saved_lists(querylist, idfile);
- exit(querystatus);
+ exit(successes ? PS_SUCCESS : querystatus);
}
/*
diff --git a/fetchmail.man b/fetchmail.man
index 636d1167..964beb4c 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -1101,8 +1101,9 @@ details.
.PP
When
.I fetchmail
-queries more than one host, the returned status is that of the last
-host queried.
+queries more than one host, return status is 0 if \fIany\fR query
+successfully retrieved mail. Otherwise the returned error status is
+that of the last host queried.
.SH AUTHOR
Eric S. Raymond <esr@snark.thyrsus.com>.