From: Brendan Cully Date: Wed, 14 Mar 2007 19:58:33 +0000 (-0700) Subject: Always give realpath a shot at the hcache folder name. Remove other hacks. X-Git-Tag: mutt-1-5-15-rel~47^2~18^2~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b74134872189a9ffe008e4503f68de25e98555a;p=mutt Always give realpath a shot at the hcache folder name. Remove other hacks. --- diff --git a/hcache.c b/hcache.c index ef760d6a..b5b3d59e 100644 --- a/hcache.c +++ b/hcache.c @@ -770,13 +770,12 @@ mutt_hcache_store_raw (header_cache_t* h, const char* filename, void* data, } static char* get_foldername(const char *folder) { - size_t flen = mutt_strlen (folder); char *p = NULL; struct stat st; - /* if the folder exists and doesn't start with /, - * prepend cwd to always use the same hcache per folder */ - if (stat (folder, &st) == 0 && flen > 0 && *folder != '/') + /* if the folder is local, canonify the path to avoid + * to ensure equivalent paths share the hcache */ + if (stat (folder, &st) == 0) { p = safe_malloc (_POSIX_PATH_MAX+1); if (!realpath (folder, p)) @@ -784,10 +783,6 @@ static char* get_foldername(const char *folder) { } else p = safe_strdup (folder); - /* make sure we have no trailing / as added by tab completion */ - if (flen > 0 && p[flen-1] == '/') - p[flen-1] = '\0'; - return p; }