]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: mail_index_sync_map() - Always return -1 on I/O failures
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 10 Aug 2020 14:33:07 +0000 (17:33 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 23 Nov 2020 13:19:55 +0000 (13:19 +0000)
Even though with force=FALSE in theory it would be possible to work around
it, but more likely it will just cause another I/O error. This simplifies
the code for the following changes.

src/lib-index/mail-index-sync-update.c

index 494e2c9b397d4e3ae82910b45c2675a874265faa..751481abf17ea0da18acb0f9e6055973e223eb82 100644 (file)
@@ -959,12 +959,11 @@ int mail_index_sync_map(struct mail_index_map **_map,
                                            &reset, &reason);
        if (ret <= 0) {
                mail_index_view_close(&view);
-               if (force && ret < 0) {
-                       /* if we failed because of a syscall error, make sure
-                          we return a failure. */
+               if (ret < 0) {
+                       /* I/O failure */
                        return -1;
                }
-               if (force && ret == 0) {
+               if (force) {
                        /* the seq/offset is probably broken */
                        mail_index_set_error(index, "Index %s: Lost log for "
                                "seq=%u offset=%"PRIuUOFF_T": %s "