fixed core when specifying multiple mailboxes on the command line

This commit is contained in:
Michael Elkins 2001-06-21 20:45:50 +00:00
parent 8af21c5604
commit ea361ad116

11
main.c
View File

@ -218,8 +218,7 @@ main (int argc, char **argv)
load_config (config); load_config (config);
for (box = boxes; (all && box) || (!all && argv[optind]); for (box = boxes; (all && box) || (!all && argv[optind]); optind++)
box = box->next, optind++)
{ {
if (!all) if (!all)
{ {
@ -261,7 +260,7 @@ main (int argc, char **argv)
if (!mail) if (!mail)
{ {
fprintf (stderr, "%s: unable to load mailbox\n", box->path); fprintf (stderr, "%s: unable to load mailbox\n", box->path);
continue; goto cleanup;
} }
imap = imap_open (box, fast ? mail->maxuid + 1 : 1, imap); imap = imap_open (box, fast ? mail->maxuid + 1 : 1, imap);
@ -269,7 +268,7 @@ main (int argc, char **argv)
{ {
fprintf (stderr, "%s: skipping mailbox due to IMAP error\n", fprintf (stderr, "%s: skipping mailbox due to IMAP error\n",
box->path); box->path);
continue; goto cleanup;
} }
if (!quiet) if (!quiet)
@ -313,6 +312,10 @@ main (int argc, char **argv)
} }
maildir_close (mail); maildir_close (mail);
cleanup:
if (all)
box = box->next;
} }
/* gracefully close connection to the IMAP server */ /* gracefully close connection to the IMAP server */