aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-07-08 20:43:57 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-07-08 20:43:57 +0000
commit9aeed581a9d0ca957fb56a2844e3cb3b5ab86333 (patch)
tree0af2fdc421705f15326afa82851c73d2f325beb0
parent8983114bab665d39c49f1c48187b3c1a0fbd9fe3 (diff)
downloadfetchmail-9aeed581a9d0ca957fb56a2844e3cb3b5ab86333.tar.gz
fetchmail-9aeed581a9d0ca957fb56a2844e3cb3b5ab86333.tar.bz2
fetchmail-9aeed581a9d0ca957fb56a2844e3cb3b5ab86333.zip
Change in exit status semantics.
svn path=/trunk/; revision=1159
-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>.