]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm quota get: Report quota percentage more accurately.
authorTimo Sirainen <tss@iki.fi>
Wed, 16 Jun 2010 15:49:56 +0000 (16:49 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 16 Jun 2010 15:49:56 +0000 (16:49 +0100)
The *100 can't overflow quota, since quota is reported in kilobytes.

--HG--
branch : HEAD

src/plugins/quota/doveadm-quota.c

index c8e199a6d7385fe62a09eea5dc0a911af469bda0..ecfad43142f21bd7e2dc14c6da0361f5302644f3 100644 (file)
@@ -26,8 +26,8 @@ static void cmd_quota_get_root(struct quota_root *root)
                if (ret > 0) {
                        doveadm_print_num(value);
                        doveadm_print_num(limit);
-                       if (limit >= 100)
-                               doveadm_print_num(value / (limit/100));
+                       if (limit > 0)
+                               doveadm_print_num(value*100 / limit);
                        else
                                doveadm_print("0");
                } else if (ret == 0) {