dovecot-2.2: doveadm, indexer: Don't crash if STATUS_LAST_CACHED...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 5 00:13:33 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/73feea4d22aa
changeset: 16183:73feea4d22aa
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 22 10:31:38 2013 +0200
description:
doveadm, indexer: Don't crash if STATUS_LAST_CACHED_SEQ lookup fails.
(I'm sure I did this change already once, where did it go?..)

diffstat:

 src/doveadm/doveadm-mail-index.c |  6 +++---
 src/indexer/master-connection.c  |  7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)

diffs (35 lines):

diff -r eece943c7521 -r 73feea4d22aa src/doveadm/doveadm-mail-index.c
--- a/src/doveadm/doveadm-mail-index.c	Sun Mar 24 12:09:39 2013 +0200
+++ b/src/doveadm/doveadm-mail-index.c	Fri Feb 22 10:31:38 2013 +0200
@@ -38,10 +38,10 @@
 	int ret = 0;
 
 	if (mailbox_get_metadata(box, MAILBOX_METADATA_PRECACHE_FIELDS,
-				 &metadata) < 0)
+				 &metadata) < 0 ||
+	    mailbox_get_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ,
+			       &status) < 0)
 		return -1;
-	mailbox_get_open_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ,
-				&status);
 
 	seq = status.last_cached_seq + 1;
 	if (seq > status.messages) {
diff -r eece943c7521 -r 73feea4d22aa src/indexer/master-connection.c
--- a/src/indexer/master-connection.c	Sun Mar 24 12:09:39 2013 +0200
+++ b/src/indexer/master-connection.c	Fri Feb 22 10:31:38 2013 +0200
@@ -68,11 +68,10 @@
 	int ret = 0;
 
 	if (mailbox_get_metadata(box, MAILBOX_METADATA_PRECACHE_FIELDS,
-				 &metadata) < 0)
+				 &metadata) < 0 ||
+	    mailbox_get_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ,
+			       &status) < 0)
 		return -1;
-
-	mailbox_get_open_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ,
-				&status);
 	seq = status.last_cached_seq + 1;
 
 	trans = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC);


More information about the dovecot-cvs mailing list