Changeset 5034:f467353f5657 for bcache.c

Show
Ignore:
Timestamp:
2007-03-31 18:50:39 (20 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
default
Message:

Add tmp flag to bcache_put, create bcache_commit.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bcache.c

    r5020 r5034  
    132132} 
    133133 
    134 FILE* mutt_bcache_put(body_cache_t *bcache, const char *id) 
     134FILE* mutt_bcache_put(body_cache_t *bcache, const char *id, int tmp) 
    135135{ 
    136136  char path[_POSIX_PATH_MAX]; 
     
    142142    return NULL; 
    143143 
    144   path[0] = '\0'; 
    145   safe_strncat (path, sizeof (path), bcache->path, bcache->pathlen); 
    146   safe_strncat (path, sizeof (path), id, mutt_strlen (id)); 
     144  snprintf (path, sizeof (path), "%s%s%s", bcache->path, id, 
     145            tmp ? ".tmp" : ""); 
    147146 
    148147  s = strchr (path + 1, '/'); 
     
    162161} 
    163162 
     163int mutt_bcache_commit(body_cache_t* bcache, const char* id) 
     164{ 
     165  char tmpid[_POSIX_PATH_MAX]; 
     166 
     167  snprintf (tmpid, sizeof (tmpid), "%s.tmp", id); 
     168 
     169  return mutt_bcache_move (bcache, tmpid, id); 
     170} 
     171 
    164172int mutt_bcache_move(body_cache_t* bcache, const char* id, const char* newid) 
    165173{