From: Brendan Cully Date: Mon, 26 Jan 2009 20:32:30 +0000 (-0800) Subject: Remove old bcache tmpfile before trying to create new one. Closes #3163. X-Git-Tag: neomutt-20160307~775 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a4e7ab93b03aba889613fb6252e739e16d9189ae;p=neomutt Remove old bcache tmpfile before trying to create new one. Closes #3163. --- diff --git a/ChangeLog b/ChangeLog index 4ef5bbd31..bb842e88c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-01-20 12:34 -0800 René Clerc (2006526d1d26) + + * po/nl.po: Updated Dutch translation + +2009-01-19 20:39 -0800 Ivan Vilata i Balaguer (038f1e5cdaea) + + * po/ca.po: Updated Catalan translation + 2009-01-14 20:04 +0000 Emanuele Giaquinta (ddf48761aacf) * imap/browse.c: Use imap_utf7_encode instead of diff --git a/bcache.c b/bcache.c index 60e5fdca5..81538d22a 100644 --- a/bcache.c +++ b/bcache.c @@ -136,6 +136,13 @@ FILE* mutt_bcache_put(body_cache_t *bcache, const char *id, int tmp) snprintf (path, sizeof (path), "%s%s%s", bcache->path, id, tmp ? ".tmp" : ""); + if ((fp = safe_fopen (path, "w+"))) + goto out; + + if (errno == EEXIST) + /* clean up leftover tmp file */ + mutt_unlink (path); + s = strchr (path + 1, '/'); while (!(fp = safe_fopen (path, "w+")) && errno == ENOENT && s) { @@ -147,6 +154,7 @@ FILE* mutt_bcache_put(body_cache_t *bcache, const char *id, int tmp) s = strchr (s + 1, '/'); } + out: dprint (3, (debugfile, "bcache: put: '%s'\n", path)); return fp;