summaryrefslogtreecommitdiffstats
path: root/usr.sbin/repquota
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1999-11-01 04:46:09 +0000
committerjulian <julian@FreeBSD.org>1999-11-01 04:46:09 +0000
commit5b57e9c591261e0fbaa6abc2d4926227d2c2b322 (patch)
tree9ca200bd15e1840eef7cbd9edbb18c3f4b8ed555 /usr.sbin/repquota
parent87613566270d4d5972427a3777ee6b48f03466ed (diff)
downloadFreeBSD-src-5b57e9c591261e0fbaa6abc2d4926227d2c2b322.zip
FreeBSD-src-5b57e9c591261e0fbaa6abc2d4926227d2c2b322.tar.gz
Description
repquota reports softlimits, hardlimits and ``used'' field incorrectly, namely those numbers get wrapped modulo 4Gbytes. PR: bin/8164 Submitted by: Anton Berezin <tobez@plab.ku.dk>
Diffstat (limited to 'usr.sbin/repquota')
-rw-r--r--usr.sbin/repquota/repquota.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c
index 8a905cc..3c9aca3 100644
--- a/usr.sbin/repquota/repquota.c
+++ b/usr.sbin/repquota/repquota.c
@@ -65,6 +65,17 @@ static const char rcsid[] =
#include <unistd.h>
#include <utmp.h>
+/* Let's be paranoid about block size */
+#if 10 > DEV_BSHIFT
+#define dbtokb(db) \
+ ((off_t)(db) >> (10-DEV_BSHIFT))
+#elif 10 < DEV_BSHIFT
+#define dbtokb(db) \
+ ((off_t)(db) << (DEV_BSHIFT-10))
+#else
+#define dbtokb(db) (db)
+#endif
+
#define max(a,b) ((a) >= (b) ? (a) : (b))
char *qfname = QUOTAFILENAME;
@@ -238,9 +249,9 @@ repquota(fs, type, qfpathname)
fup->fu_dqblk.dqb_isoftlimit &&
fup->fu_dqblk.dqb_curinodes >=
fup->fu_dqblk.dqb_isoftlimit ? '+' : '-',
- (u_long)(dbtob(fup->fu_dqblk.dqb_curblocks) / 1024),
- (u_long)(dbtob(fup->fu_dqblk.dqb_bsoftlimit) / 1024),
- (u_long)(dbtob(fup->fu_dqblk.dqb_bhardlimit) / 1024),
+ (u_long)(dbtokb(fup->fu_dqblk.dqb_curblocks)),
+ (u_long)(dbtokb(fup->fu_dqblk.dqb_bsoftlimit)),
+ (u_long)(dbtokb(fup->fu_dqblk.dqb_bhardlimit)),
fup->fu_dqblk.dqb_bsoftlimit &&
fup->fu_dqblk.dqb_curblocks >=
fup->fu_dqblk.dqb_bsoftlimit ?
OpenPOWER on IntegriCloud