Explicitely cast to (u_quad_t) calls to btodb() and dbtob() to avoid
int overflow. It's now possible to add/display quotas of more than 4G. XXX I'm sure there is a PR open on this but I couln't find it with the usual search engines. If someone knows it's number ...
This commit is contained in:
parent
30af11dbd4
commit
7616130d51
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: quota.c,v 1.21 1998/08/25 20:59:39 ross Exp $ */
|
||||
/* $NetBSD: quota.c,v 1.22 1999/12/16 17:29:52 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1990, 1993
|
||||
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)quota.c 8.4 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: quota.c,v 1.21 1998/08/25 20:59:39 ross Exp $");
|
||||
__RCSID("$NetBSD: quota.c,v 1.22 1999/12/16 17:29:52 bouyer Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -350,7 +350,8 @@ showquotas(type, id, name)
|
||||
>= qup->dqblk.dqb_bsoftlimit) {
|
||||
if (qup->dqblk.dqb_btime > now)
|
||||
msgb = "In block grace period on";
|
||||
else msgb = "Over block quota on";
|
||||
else
|
||||
msgb = "Over block quota on";
|
||||
}
|
||||
}
|
||||
if (qflag) {
|
||||
@ -373,12 +374,15 @@ showquotas(type, id, name)
|
||||
printf("%s\n", qup->fsname);
|
||||
nam = "";
|
||||
}
|
||||
printf("%15s%8d%c%7d%8d%8s"
|
||||
printf("%12s%9d%c%8d%9d%8s"
|
||||
, nam
|
||||
, dbtob(qup->dqblk.dqb_curblocks) / 1024
|
||||
, (int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks)
|
||||
/ 1024)
|
||||
, (msgb == (char *)0) ? ' ' : '*'
|
||||
, dbtob(qup->dqblk.dqb_bsoftlimit) / 1024
|
||||
, dbtob(qup->dqblk.dqb_bhardlimit) / 1024
|
||||
, (int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit)
|
||||
/ 1024)
|
||||
, (int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit)
|
||||
/ 1024)
|
||||
, (msgb == (char *)0) ? ""
|
||||
: timeprt(qup->dqblk.dqb_btime));
|
||||
printf("%8d%c%7d%8d%8s\n"
|
||||
@ -406,7 +410,7 @@ heading(type, id, name, tag)
|
||||
printf("Disk quotas for %s %s (%cid %ld): %s\n", qfextension[type],
|
||||
name, *qfextension[type], (u_long)id, tag);
|
||||
if (!qflag && tag[0] == '\0') {
|
||||
printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n"
|
||||
printf("%12s%9s %8s%9s%8s%8s %7s%8s%8s\n"
|
||||
, "Filesystem"
|
||||
, "blocks"
|
||||
, "quota"
|
||||
|
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: edquota.c,v 1.18 1999/08/16 03:12:31 simonb Exp $");
|
||||
__RCSID("$NetBSD: edquota.c,v 1.19 1999/12/16 17:29:53 bouyer Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -405,9 +405,9 @@ writeprivs(quplist, outfd, name, quotatype)
|
||||
for (qup = quplist; qup; qup = qup->next) {
|
||||
fprintf(fd, "%s: %s %d, limits (soft = %d, hard = %d)\n",
|
||||
qup->fsname, "blocks in use:",
|
||||
dbtob(qup->dqblk.dqb_curblocks) / 1024,
|
||||
dbtob(qup->dqblk.dqb_bsoftlimit) / 1024,
|
||||
dbtob(qup->dqblk.dqb_bhardlimit) / 1024);
|
||||
(int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks) / 1024),
|
||||
(int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit) / 1024),
|
||||
(int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit) / 1024));
|
||||
fprintf(fd, "%s %d, limits (soft = %d, hard = %d)\n",
|
||||
"\tinodes in use:", qup->dqblk.dqb_curinodes,
|
||||
qup->dqblk.dqb_isoftlimit, qup->dqblk.dqb_ihardlimit);
|
||||
@ -460,9 +460,12 @@ readprivs(quplist, infd)
|
||||
warnx("%s:%s: bad format", fsp, cp);
|
||||
return (0);
|
||||
}
|
||||
dqblk.dqb_curblocks = btodb(dqblk.dqb_curblocks * 1024);
|
||||
dqblk.dqb_bsoftlimit = btodb(dqblk.dqb_bsoftlimit * 1024);
|
||||
dqblk.dqb_bhardlimit = btodb(dqblk.dqb_bhardlimit * 1024);
|
||||
dqblk.dqb_curblocks = btodb((u_quad_t)
|
||||
dqblk.dqb_curblocks * 1024);
|
||||
dqblk.dqb_bsoftlimit = btodb((u_quad_t)
|
||||
dqblk.dqb_bsoftlimit * 1024);
|
||||
dqblk.dqb_bhardlimit = btodb((u_quad_t)
|
||||
dqblk.dqb_bhardlimit * 1024);
|
||||
if ((cp = strtok(line2, "\n")) == NULL) {
|
||||
warnx("%s: %s: bad format", fsp, line2);
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user