If two processes are creating the index files at the same time, don't have
one of them delete the dovecot.index.cache that the other one just created.
This means we never should be calling mail_cache_create(), so it was removed
entirely.
return cache;
}
-struct mail_cache *mail_cache_create(struct mail_index *index)
-{
- struct mail_cache *cache;
-
- cache = mail_cache_alloc(index);
- if (!MAIL_INDEX_IS_IN_MEMORY(index)) {
- if (unlink(cache->filepath) < 0 && errno != ENOENT)
- mail_cache_set_syscall_error(cache, "unlink()");
- }
- return cache;
-}
-
void mail_cache_free(struct mail_cache **_cache)
{
struct mail_cache *cache = *_cache;
};
struct mail_cache *mail_cache_open_or_create(struct mail_index *index);
-struct mail_cache *mail_cache_create(struct mail_index *index);
void mail_cache_free(struct mail_cache **cache);
/* Register fields. fields[].idx is updated to contain field index.
enum mail_index_open_flags flags)
{
int ret;
- bool created = FALSE;
ret = mail_transaction_log_open(index->log);
if (ret == 0) {
index->map->hdr.indexid = index->indexid;
}
index->initial_create = FALSE;
- created = TRUE;
}
if (ret >= 0) {
ret = index->map != NULL ? 1 : mail_index_try_open(index);
return -1;
}
- if (index->cache == NULL) {
- index->cache = created ? mail_cache_create(index) :
- mail_cache_open_or_create(index);
- }
+ if (index->cache == NULL)
+ index->cache = mail_cache_open_or_create(index);
return 1;
}