dovecot-2.2: lib-storage: Don't open mailbox on mailbox_get_stat...

dovecot at dovecot.org dovecot at dovecot.org
Tue Apr 15 13:32:32 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/3a6b64bff7ea
changeset: 17210:3a6b64bff7ea
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 15 15:21:37 2014 +0200
description:
lib-storage: Don't open mailbox on mailbox_get_status() if we have no status items left to get.

diffstat:

 src/lib-storage/index/index-status.c |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (16 lines):

diff -r 6fd12fbe6848 -r 3a6b64bff7ea src/lib-storage/index/index-status.c
--- a/src/lib-storage/index/index-status.c	Tue Apr 15 15:13:28 2014 +0200
+++ b/src/lib-storage/index/index-status.c	Tue Apr 15 15:21:37 2014 +0200
@@ -33,6 +33,12 @@
 			     enum mailbox_status_items items,
 			     struct mailbox_status *status_r)
 {
+	if (items == 0) {
+		/* caller could have wanted only e.g. mailbox_status.have_*
+		   flags */
+		return 0;
+	}
+
 	if (!box->opened) {
 		if (mailbox_open(box) < 0)
 			return -1;


More information about the dovecot-cvs mailing list