X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=buffy.c;h=a6436c2f0f734806349d8f2e8701d047db82624c;hp=67800dd76cd18a01d0052033723232158bfdd0b0;hb=1fb9b0f4797559d8269d2dd012f005af7f5e560b;hpb=9c02039bb94c2fb846e0226c321c7dd79df455c4 diff --git a/buffy.c b/buffy.c index 67800dd..a6436c2 100644 --- a/buffy.c +++ b/buffy.c @@ -135,19 +135,21 @@ int test_new_folder (const char *path) BUFFY *mutt_find_mailbox (const char *path) { - BUFFY *tmp = NULL; struct stat sb; struct stat tmp_sb; + int i = 0; if (stat (path, &sb) != 0) return NULL; - for (tmp = Incoming; tmp; tmp = tmp->next) { - if (stat (tmp->path, &tmp_sb) == 0 && - sb.st_dev == tmp_sb.st_dev && sb.st_ino == tmp_sb.st_ino) - break; + if (!list_empty(Incoming)) { + for (i = 0; i < Incoming->length; i++) { + if (stat (Incoming->data[i], &tmp_sb) == 0 && + sb.st_dev == tmp_sb.st_dev && sb.st_ino == tmp_sb.st_ino) + return ((BUFFY*) Incoming->data[i]); + } } - return tmp; + return (NULL); } void mutt_update_mailbox (BUFFY * b) @@ -588,7 +590,7 @@ int mutt_buffy_list (void) first = 0; } } - if (!first && tmp) { + if (!first && i < Incoming->length) { strncat (buffylist + pos, ", ...", sizeof (buffylist) - 1 - pos); /* __STRNCAT_CHECKED__ */ } if (!first) {