Changeset 5046:eabef30c9344

Show
Ignore:
Timestamp:
2007-04-02 14:33:29 (22 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Fix a segfault in the new mboxcache hcache lookup.
idata may not have an associated context, so the cache path must use
the account info instead. For harmony with the other hcache callers,
make them all canonify the path the same way with imap_hcache_open.

Location:
imap
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • imap/imap.c

    r5045 r5046  
    252252  header_cache_t *hc; 
    253253  char uidbuf[32]; 
    254    
    255   hc = mutt_hcache_open (HeaderCache, idata->ctx->path); 
     254 
     255  hc = imap_hcache_open (idata, idata->ctx->path); 
    256256#endif 
    257257 
     
    11581158#if USE_HCACHE 
    11591159  if (expunge && ctx->closing) 
    1160     hc = mutt_hcache_open (HeaderCache, idata->ctx->path); 
     1160    hc = imap_hcache_open (idata, idata->ctx->path); 
    11611161#endif 
    11621162 
     
    15831583  unsigned int *uidvalidity = NULL; 
    15841584  unsigned int *uidnext = NULL; 
    1585   char* path; 
    15861585#endif 
    15871586   
     
    16071606 
    16081607#ifdef USE_HCACHE 
    1609   path = safe_strdup (idata->ctx->path); 
    1610   url_parse_ciss (&url, path); 
     1608  mutt_account_tourl (&idata->conn->account, &url); 
    16111609  url.path = (char*)mbox; 
    16121610  url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0); 
    1613   FREE (&path); 
    16141611  hc = mutt_hcache_open (HeaderCache, urlstr); 
    16151612  if (hc) 
  • imap/imap_private.h

    r5044 r5046  
    265265 
    266266/* util.c */ 
     267#ifdef USE_HCACHE 
     268void* imap_hcache_open (IMAP_DATA* idata, const char* path); 
     269#endif 
     270 
    267271int imap_continue (const char* msg, const char* resp); 
    268272void imap_error (const char* where, const char* msg); 
  • imap/message.c

    r5044 r5046  
    123123#if USE_HCACHE 
    124124  if (!msgbegin) 
    125     hc = mutt_hcache_open (HeaderCache, ctx->path); 
     125    hc = imap_hcache_open (idata, ctx->path); 
    126126 
    127127  if (hc) 
  • imap/util.c

    r4973 r5046  
    6767} 
    6868 
     69#ifdef USE_HCACHE 
     70void* imap_hcache_open (IMAP_DATA* idata, const char* path) 
     71{ 
     72  IMAP_MBOX mx; 
     73  ciss_url_t url; 
     74  char cachepath[LONG_STRING]; 
     75 
     76  if (imap_parse_path (path, &mx) < 0) 
     77    return NULL; 
     78 
     79  mutt_account_tourl (&idata->conn->account, &url); 
     80  url.path = mx.mbox; 
     81  url_ciss_tostring (&url, cachepath, sizeof (cachepath), 0); 
     82  FREE (&mx.mbox); 
     83 
     84  return mutt_hcache_open (HeaderCache, cachepath); 
     85} 
     86#endif 
     87 
    6988/* imap_parse_path: given an IMAP mailbox name, return host, port 
    7089 *   and a path IMAP servers will recognise.