]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Don't break indexes on syscall failures during index refreshing.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 19 Jun 2016 22:47:59 +0000 (01:47 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 19 Jun 2016 22:47:59 +0000 (01:47 +0300)
Especially mmap() failures due to out of memory could have triggered this.
We treated the open as successful, which meant that an empty index was
opened.

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

index 3bbd99822d991013b86b2fe9f6ecc38ed1b8f976..394062f772722c2b00e4cf94539b79805bfe15ed 100644 (file)
@@ -955,6 +955,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. */
+                       return -1;
+               }
                if (force && ret == 0) {
                        /* the seq/offset is probably broken */
                        mail_index_set_error(index, "Index %s: Lost log for "