changeset 20337:9ab47cf0fb26

lib-index: Don't break indexes on syscall failures during index refreshing. 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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 20 Jun 2016 01:47:59 +0300
parents e8ee0a7de1df
children 2a05c653d223
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Sun Jun 19 23:18:43 2016 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Mon Jun 20 01:47:59 2016 +0300
@@ -955,6 +955,11 @@
 					    &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 "