From a7940f5d16bb602f27d16120d2bf89575eb7d715 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sat, 22 Nov 2014 00:23:45 +0100 Subject: Error out if user combines --idle with multiple mailboxes. --- NEWS | 2 ++ fetchmail.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3