- static char mutt_hcache_per_folder_path[_POSIX_PATH_MAX];
- struct stat path_stat;
- MD5_CTX md5;
- unsigned char md5sum[16];
- int ret;
-
- ret = stat (path, &path_stat);
- if (ret < 0) {
- return path;
- }
-
- if (!S_ISDIR (path_stat.st_mode)) {
- return path;
- }
-
- MD5Init (&md5);
- MD5Update (&md5, (unsigned char *) folder, m_strlen(folder));
- MD5Final (md5sum, &md5);
-
- ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
- "%s/%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x",
- path, md5sum[0], md5sum[1], md5sum[2], md5sum[3],
- md5sum[4], md5sum[5], md5sum[6], md5sum[7], md5sum[8],
- md5sum[9], md5sum[10], md5sum[11], md5sum[12],
- md5sum[13], md5sum[14], md5sum[15]);
-
- if (ret <= 0) {
- return path;
- }
-
- return mutt_hcache_per_folder_path;
-}
-
-/* This function transforms a header into a char so that it is useable by
- * db_store */
-static void *mutt_hcache_dump (void *_db, HEADER * h, int *off,
- unsigned long uid_validity)
-{
- struct header_cache *db = _db;
- unsigned char *d = NULL;
-
- *off = 0;
-
- d = lazy_malloc (sizeof (validate));