changeset 12920:618f610c7c67

quota: Fixed checking message count limit when saving multiple mails in transaction.
author Timo Sirainen <tss@iki.fi>
date Mon, 04 Apr 2011 23:18:31 +0300
parents 8fa544520413
children 230458801916
files src/plugins/quota/quota.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota.c	Mon Apr 04 23:07:37 2011 +0300
+++ b/src/plugins/quota/quota.c	Mon Apr 04 23:18:31 2011 +0300
@@ -1170,7 +1170,8 @@
 
 	*too_large_r = FALSE;
 
-	if (ctx->count_left != 0 && ctx->bytes_left >= ctx->bytes_used + size)
+	if ((int64_t)ctx->count_left >= ctx->count_used + 1 &&
+	    (int64_t)ctx->bytes_left >= ctx->bytes_used + (off_t)size)
 		return 1;
 
 	roots = array_get(&ctx->quota->roots, &count);