From 891adddff117791e77d64744e9aab61fe5dc9676 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 14 Oct 2025 12:58:23 +0300 Subject: [PATCH] lib-index: Avoid unsafe errno check scan-build thinks mail_cache_file_close() could have modified errno. This doesn't seem to actually happen, but it's safer to make sure of it. --- src/lib-index/mail-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 44e9146120..3ae37d7986 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -144,8 +144,9 @@ static int mail_cache_try_open(struct mail_cache *cache) cache->fd = nfs_safe_open(cache->filepath, cache->index->readonly ? O_RDONLY : O_RDWR); if (cache->fd == -1) { + int err = errno; mail_cache_file_close(cache); - if (errno == ENOENT) { + if (err == ENOENT) { mail_cache_purge_later_reset(cache); return 0; } -- 2.47.3