dovecot: Check if we have maildir quota storages at all before t...

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 17 17:32:29 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/021b6900a900
changeset: 6996:021b6900a900
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 17 17:32:26 2007 +0200
description:
Check if we have maildir quota storages at all before trying to expunge
messages.

diffstat:

1 file changed, 17 insertions(+), 10 deletions(-)
src/plugins/quota/quota-maildir.c |   27 +++++++++++++++++----------

diffs (49 lines):

diff -r 2e9fcf711fc4 -r 021b6900a900 src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Mon Dec 17 17:25:40 2007 +0200
+++ b/src/plugins/quota/quota-maildir.c	Mon Dec 17 17:32:26 2007 +0200
@@ -526,21 +526,24 @@ static void maildirquota_init_limits(str
 	}
 }
 
-static int maildirquota_refresh(struct maildir_quota_root *root)
-{
-	int ret;
-
+static bool maildirquota_limits_init(struct maildir_quota_root *root)
+{
 	if (!root->limits_initialized) {
 		maildirquota_init_limits(root);
 		if (root->maildirsize_path == NULL) {
 			i_warning("quota maildir: No maildir storages, "
 				  "ignoring quota.");
-			return 0;
-		}
-	} else {
-		if (root->maildirsize_path == NULL)
-			return 0;
-	}
+		}
+	}
+	return root->maildirsize_path != NULL;
+}
+
+static int maildirquota_refresh(struct maildir_quota_root *root)
+{
+	int ret;
+
+	if (!maildirquota_limits_init(root))
+		return 0;
 
 	T_FRAME(
 		ret = maildirsize_read(root);
@@ -697,6 +700,10 @@ maildir_quota_update(struct quota_root *
 	struct maildir_quota_root *root =
 		(struct maildir_quota_root *) _root;
 
+	if (!maildirquota_limits_init(root)) {
+		/* no limits */
+		return 0;
+	}
 	/* make sure the latest file is opened. */
 	(void)maildirsize_open(root);
 


More information about the dovecot-cvs mailing list