Mercurial > dovecot > core-2.2
changeset 18490:2dbee58a1a0d
trash plugin: Fixed handling unlimited quota limits.
Patch by Alexei Gradinari
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 29 Apr 2015 10:22:26 +0200 |
parents | e00f9e93a9a3 |
children | 8898c5ea38f2 |
files | src/plugins/trash/trash-plugin.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c Wed Apr 29 10:13:19 2015 +0200 +++ b/src/plugins/trash/trash-plugin.c Wed Apr 29 10:22:26 2015 +0200 @@ -204,8 +204,16 @@ ctx->count_over = 0; } - ctx->bytes_ceil += size_expunged; - ctx->count_ceil += expunged_count; + if (ctx->bytes_ceil > ((uint64_t)-1 - size_expunged)) { + ctx->bytes_ceil = (uint64_t)-1; + } else { + ctx->bytes_ceil += size_expunged; + } + if (ctx->count_ceil < ((uint64_t)-1 - expunged_count)) { + ctx->count_ceil = (uint64_t)-1; + } else { + ctx->count_ceil += expunged_count; + } return 1; }