Changeset 5020:034ad0e55397 for bcache.c

Show
Ignore:
Timestamp:
2007-03-29 10:30:15 (20 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
default
Message:

Make message cache write to temporary location until file is complete.
Previously mutt trusted the cache file even when it was incomplete,
causing permanently incorrect message display if the fetch was
interrupted for some reason.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bcache.c

    r4687 r5020  
    162162} 
    163163 
     164int mutt_bcache_move(body_cache_t* bcache, const char* id, const char* newid) 
     165{ 
     166  char path[_POSIX_PATH_MAX]; 
     167  char newpath[_POSIX_PATH_MAX]; 
     168 
     169  if (!bcache || !id || !*id || !newid || !*newid) 
     170    return -1; 
     171 
     172  snprintf (path, sizeof (path), "%s%s", bcache->path, id); 
     173  snprintf (newpath, sizeof (newpath), "%s%s", bcache->path, newid); 
     174 
     175  dprint (3, (debugfile, "bcache: mv: '%s' '%s'\n", path, newpath)); 
     176 
     177  return rename (path, newpath); 
     178} 
     179 
    164180int mutt_bcache_del(body_cache_t *bcache, const char *id) 
    165181{