From: Timo Sirainen Date: Wed, 1 Apr 2020 14:02:03 +0000 (+0300) Subject: lib-index: mail_cache_sync_reset_id() - Move cache unlocking to caller X-Git-Tag: 2.3.11.2~445 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=532e4c087f2a7970b47479404039f84422adb2ff;p=thirdparty%2Fdovecot%2Fcore.git lib-index: mail_cache_sync_reset_id() - Move cache unlocking to caller --- diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 2384532fef..0e464143a2 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -670,14 +670,10 @@ static int mail_cache_sync_reset_id(struct mail_cache *cache) break; /* mismatch. try refreshing index once. if that doesn't help, we can't use the cache. */ - if (i > 0 || cache->index->mapping) { - mail_cache_unlock_file(cache); + if (i > 0 || cache->index->mapping) return 0; - } - if (mail_index_refresh(cache->index) < 0) { - mail_cache_unlock_file(cache); + if (mail_index_refresh(cache->index) < 0) return -1; - } } return 1; } @@ -718,8 +714,10 @@ mail_cache_lock_full(struct mail_cache *cache, bool nonblock) /* okay, so it was just compressed. try again. */ } - if ((ret = mail_cache_sync_reset_id(cache)) <= 0) + if ((ret = mail_cache_sync_reset_id(cache)) <= 0) { + mail_cache_unlock_file(cache); return ret; + } /* successfully locked - make sure our header is up to date */ cache->locked = TRUE;