Mercurial > dovecot > core-2.2
changeset 12922:6cc356a5d0a5
quota: Fixed the quota limit check changes in previous commit.
Casting (uint64_t)-1 to (int64_t) isn't a good idea.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 05 Apr 2011 13:26:45 +0300 |
parents | 230458801916 |
children | 64f354128f4e |
files | src/plugins/quota/quota.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota.c Mon Apr 04 23:19:01 2011 +0300 +++ b/src/plugins/quota/quota.c Tue Apr 05 13:26:45 2011 +0300 @@ -1170,8 +1170,10 @@ *too_large_r = FALSE; - if (ctx->count_used + 1 <= (int64_t)ctx->count_ceil && - ctx->bytes_used + (off_t)size <= (int64_t)ctx->bytes_ceil) + if ((ctx->count_used < 0 || + (uint64_t)ctx->count_used + 1 <= ctx->count_ceil) && + ((ctx->bytes_used < 0 && size <= ctx->bytes_ceil) || + (uint64_t)ctx->bytes_used + size <= ctx->bytes_ceil)) return 1; /* limit reached. only thing left to do now is to set too_large_r. */