aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2014-11-22 00:23:45 +0100
committerMatthias Andree <matthias.andree@gmx.de>2014-11-22 00:23:45 +0100
commita7940f5d16bb602f27d16120d2bf89575eb7d715 (patch)
tree30f1df38f530bca312052fcf0c68c2d26c33516e
parent2816976745d273051504b8a82d87d48f7f5c3ee7 (diff)
downloadfetchmail-a7940f5d16bb602f27d16120d2bf89575eb7d715.tar.gz
fetchmail-a7940f5d16bb602f27d16120d2bf89575eb7d715.tar.bz2
fetchmail-a7940f5d16bb602f27d16120d2bf89575eb7d715.zip
Error out if user combines --idle with multiple mailboxes.
-rw-r--r--NEWS2
-rw-r--r--fetchmail.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 779e5694..0703c319 100644
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,8 @@ fetchmail-6.3.27 (not yet released, if ever):
* Do not translate header tags such as "Subject:". Reported by Gonzalo Pérez de
Olaguer Córdoba, Debian Bug#744907.
* Convert most links from berlios.de to sourceforge.net.
+* Report error to stderr, and exit, if --idle is combined with multiple
+ accounts.
# KNOWN BUGS AND WORKAROUNDS
(This section floats upwards through the NEWS file so it stays with the
diff --git a/fetchmail.c b/fetchmail.c
index ae30f90a..5f31d6ec 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -1035,6 +1035,8 @@ static int load_params(int argc, char **argv, int optind)
struct query def_opts, *ctl;
struct stat rcstat;
char *p;
+ unsigned int mboxcount = 0;
+ unsigned int idlecount = 0;
run.bouncemail = TRUE;
run.softbounce = TRUE; /* treat permanent errors as temporary */
@@ -1236,7 +1238,7 @@ static int load_params(int argc, char **argv, int optind)
/*
* We no longer do DNS lookups at startup.
- * This is a kluge. It enables users to edit their
+ * This is a kludge. It enables users to edit their
* configurations when DNS isn't available.
*/
ctl->server.truename = xstrdup(ctl->server.queryname);
@@ -1386,9 +1388,18 @@ static int load_params(int argc, char **argv, int optind)
(void) fprintf(stderr,
GT_("Both fetchall and keep on in daemon or idle mode is a mistake!\n"));
}
+
+ if (ctl->idle) ++idlecount;
+ mboxcount += count_list(&ctl->mailboxes);
}
}
+ if (idlecount && mboxcount > 1) {
+ fprintf(stderr,
+ GT_("fetchmail: Error: idle mode does not work for multiple folders or accounts!\n"));
+ exit(PS_SYNTAX);
+ }
+
/*
* If the user didn't set a last-resort user to get misaddressed
* multidrop mail, set an appropriate default here.