X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Fmessage.c;h=6e6314d2ff1aa82d57d2f4bb45372d8d25c6ac4a;hb=7480539010bab6905c944b11b036492a1a625994;hp=429171353d597a4e0b317f32ab7e36d02cc432a8;hpb=e83ad1be25aefea3ed21ec08edbaf2d5a72c4a9d;p=apps%2Fmadmutt.git diff --git a/imap/message.c b/imap/message.c index 4291713..6e6314d 100644 --- a/imap/message.c +++ b/imap/message.c @@ -335,16 +335,10 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) cache = &idata->cache[cacheno]; if (cache->path) { - if (cache->uid == HEADER_DATA (h)->uid) { - /* yes, so just return a pointer to the message */ - if (!(msg->fp = fopen (cache->path, "r"))) { - mutt_perror (cache->path); - return (-1); - } + /* don't treat cache errors as fatal, just fall back. */ + if (cache->uid == HEADER_DATA(h)->uid && (msg->fp = fopen (cache->path, "r"))) return 0; - } else { - /* clear the previous entry */ unlink (cache->path); FREE (&cache->path); } @@ -423,6 +417,12 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) /* see comment before command start. */ h->active = 1; + fflush (msg->fp); + if (ferror (msg->fp)) { + mutt_perror (cache->path); + goto bail; + } + if (rc != IMAP_CMD_OK) goto bail;