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. --- fetchmail.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'fetchmail.c') 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