dovecot-2.2: lib-storage: Added asserts to make sure mailbox_ope...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 25 21:45:17 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/78d9adf7c149
changeset: 15101:78d9adf7c149
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 25 20:51:07 2012 +0300
description:
lib-storage: Added asserts to make sure mailbox_open() is called early enough.

diffstat:

 src/lib-storage/mail-storage.c |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (48 lines):

diff -r f8c1ddf55b94 -r 78d9adf7c149 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Tue Sep 25 20:15:58 2012 +0300
+++ b/src/lib-storage/mail-storage.c	Tue Sep 25 20:51:07 2012 +0300
@@ -1299,6 +1299,8 @@
 
 bool mailbox_is_readonly(struct mailbox *box)
 {
+	i_assert(box->opened);
+
 	return box->v.is_readonly(box);
 }
 
@@ -1354,6 +1356,8 @@
 
 enum mail_flags mailbox_get_private_flags_mask(struct mailbox *box)
 {
+	i_assert(box->opened);
+
 	if (box->v.get_private_flags_mask != NULL)
 		return box->v.get_private_flags_mask(box);
 	else if (box->list->set.index_pvt_dir != NULL)
@@ -1428,6 +1432,8 @@
 void mailbox_notify_changes(struct mailbox *box,
 			    mailbox_notify_callback_t *callback, void *context)
 {
+	i_assert(box->opened);
+
 	box->notify_callback = callback;
 	box->notify_context = context;
 
@@ -1436,6 +1442,8 @@
 
 void mailbox_notify_changes_stop(struct mailbox *box)
 {
+	i_assert(box->opened);
+
 	box->notify_callback = NULL;
 	box->notify_context = NULL;
 
@@ -1525,6 +1533,8 @@
 {
 	struct mailbox_transaction_context *trans;
 
+	i_assert(box->opened);
+
 	box->transaction_count++;
 	trans = box->v.transaction_begin(box, flags);
 	trans->flags = flags;


More information about the dovecot-cvs mailing list