dovecot-2.2: trash plugin fixes

dovecot at dovecot.org dovecot at dovecot.org
Sun May 20 03:26:32 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/51b40cffb628
changeset: 14459:51b40cffb628
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 18 19:29:22 2012 +0300
description:
trash plugin fixes

diffstat:

 src/plugins/trash/trash-plugin.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (43 lines):

diff -r ea7ca6330491 -r 51b40cffb628 src/plugins/trash/trash-plugin.c
--- a/src/plugins/trash/trash-plugin.c	Wed Apr 18 18:33:02 2012 +0300
+++ b/src/plugins/trash/trash-plugin.c	Wed Apr 18 19:29:22 2012 +0300
@@ -158,9 +158,10 @@
 		trash->mail = NULL;
 		(void)mailbox_search_deinit(&trash->search_ctx);
 
-		if (size_expunged >= size_needed)
+		if (size_expunged >= size_needed) {
 			(void)mailbox_transaction_commit(&trash->trans);
-		else {
+			(void)mailbox_sync(trash->box, 0);
+		} else {
 			/* couldn't get enough space, don't expunge anything */
                         mailbox_transaction_rollback(&trash->trans);
 		}
@@ -175,14 +176,12 @@
 				(unsigned long long)size_needed,
 				(unsigned long long)size_expunged);
 		}
-		return FALSE;
+		return 0;
 	}
 
-	ctx->bytes_used = ctx->bytes_used > (int64_t)size_expunged ?
-		ctx->bytes_used - size_expunged : 0;
-	ctx->count_used = ctx->count_used > (int64_t)expunged_count ?
-		ctx->count_used - expunged_count : 0;
-	return TRUE;
+	ctx->bytes_ceil += size_expunged;
+	ctx->count_ceil += expunged_count;
+	return 1;
 }
 
 static int
@@ -214,7 +213,6 @@
 		if (ret <= 0)
 			return 0;
 	}
-
 	return 0;
 }
 


More information about the dovecot-cvs mailing list