From: Brendan Cully Date: Wed, 11 Apr 2007 02:28:14 +0000 (-0700) Subject: Try to unlink old header cache if open fails X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b75f9e1c85658b21f8d58fb1580d9be44f591cf1;p=neomutt Try to unlink old header cache if open fails --- diff --git a/hcache.c b/hcache.c index 89e3d66da..d0dbeff59 100644 --- a/hcache.c +++ b/hcache.c @@ -982,6 +982,7 @@ mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) { struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE)); int (*hcache_open) (struct header_cache* h, const char* path); + struct stat sb; #if HAVE_QDBM hcache_open = hcache_open_qdbm; @@ -1008,6 +1009,12 @@ mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) return h; else { + /* remove a possibly incompatible version */ + if (!stat (path, &sb) && !unlink (path)) + { + if (!hcache_open (h, path)) + return h; + } FREE(&h->folder); FREE(&h);