]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Avoid unsafe errno check
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 14 Oct 2025 09:58:23 +0000 (12:58 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 14 Oct 2025 15:27:29 +0000 (15:27 +0000)
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

index 44e91461206e55c364dd321c3acdee65f2249909..3ae37d7986231bcdd9937ae9c7d0a13af176dc62 100644 (file)
@@ -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;
                }