mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 08:44:33 +00:00
Cast some expressions involving dbtob() to (unsigned long) and print them
using %lu. This became more broken when I fixed dbtob() to support byte offsets >= 4GB. The type had to change to [u]quad_t. Previously the expressions had type unsigned long and were printed using %d. After division by 1024, the expressions are guaranteed to fit in an unsigned long, at least for the standard DEV_BSIZE, so edquota doesn't need to know about quad_t's explicitly. Fix all the other format mismatches exposed by compiling with -Wformat (6 more quota limits of type unsigned long printed using %d and 6 time_t's (i.e., longs) printed using %d).
This commit is contained in:
parent
ee4415d3df
commit
ff55774394
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8325
|
@ -380,12 +380,12 @@ writeprivs(quplist, outfd, name, quotatype)
|
|||
}
|
||||
fprintf(fd, "Quotas for %s %s:\n", qfextension[quotatype], name);
|
||||
for (qup = quplist; qup; qup = qup->next) {
|
||||
fprintf(fd, "%s: %s %d, limits (soft = %d, hard = %d)\n",
|
||||
fprintf(fd, "%s: %s %lu, limits (soft = %lu, hard = %lu)\n",
|
||||
qup->fsname, "blocks in use:",
|
||||
dbtob(qup->dqblk.dqb_curblocks) / 1024,
|
||||
dbtob(qup->dqblk.dqb_bsoftlimit) / 1024,
|
||||
dbtob(qup->dqblk.dqb_bhardlimit) / 1024);
|
||||
fprintf(fd, "%s %d, limits (soft = %d, hard = %d)\n",
|
||||
(unsigned long)(dbtob(qup->dqblk.dqb_curblocks) / 1024),
|
||||
(unsigned long)(dbtob(qup->dqblk.dqb_bsoftlimit) / 1024),
|
||||
(unsigned long)(dbtob(qup->dqblk.dqb_bhardlimit) / 1024));
|
||||
fprintf(fd, "%s %lu, limits (soft = %lu, hard = %lu)\n",
|
||||
"\tinodes in use:", qup->dqblk.dqb_curinodes,
|
||||
qup->dqblk.dqb_isoftlimit, qup->dqblk.dqb_ihardlimit);
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ readprivs(quplist, inname)
|
|||
return (0);
|
||||
}
|
||||
cnt = sscanf(cp,
|
||||
" blocks in use: %d, limits (soft = %d, hard = %d)",
|
||||
" blocks in use: %lu, limits (soft = %lu, hard = %lu)",
|
||||
&dqblk.dqb_curblocks, &dqblk.dqb_bsoftlimit,
|
||||
&dqblk.dqb_bhardlimit);
|
||||
if (cnt != 3) {
|
||||
|
@ -443,7 +443,7 @@ readprivs(quplist, inname)
|
|||
return (0);
|
||||
}
|
||||
cnt = sscanf(cp,
|
||||
"\tinodes in use: %d, limits (soft = %d, hard = %d)",
|
||||
"\tinodes in use: %lu, limits (soft = %lu, hard = %lu)",
|
||||
&dqblk.dqb_curinodes, &dqblk.dqb_isoftlimit,
|
||||
&dqblk.dqb_ihardlimit);
|
||||
if (cnt != 3) {
|
||||
|
@ -568,7 +568,7 @@ readtimes(quplist, inname)
|
|||
return (0);
|
||||
}
|
||||
cnt = sscanf(cp,
|
||||
" block grace period: %d %s file grace period: %d %s",
|
||||
" block grace period: %ld %s file grace period: %ld %s",
|
||||
&btime, bunits, &itime, iunits);
|
||||
if (cnt != 4) {
|
||||
fprintf(stderr, "%s:%s: bad format\n", fsp, cp);
|
||||
|
@ -614,15 +614,15 @@ cvtstoa(time)
|
|||
|
||||
if (time % (24 * 60 * 60) == 0) {
|
||||
time /= 24 * 60 * 60;
|
||||
sprintf(buf, "%d day%s", time, time == 1 ? "" : "s");
|
||||
sprintf(buf, "%ld day%s", time, time == 1 ? "" : "s");
|
||||
} else if (time % (60 * 60) == 0) {
|
||||
time /= 60 * 60;
|
||||
sprintf(buf, "%d hour%s", time, time == 1 ? "" : "s");
|
||||
sprintf(buf, "%ld hour%s", time, time == 1 ? "" : "s");
|
||||
} else if (time % 60 == 0) {
|
||||
time /= 60;
|
||||
sprintf(buf, "%d minute%s", time, time == 1 ? "" : "s");
|
||||
sprintf(buf, "%ld minute%s", time, time == 1 ? "" : "s");
|
||||
} else
|
||||
sprintf(buf, "%d second%s", time, time == 1 ? "" : "s");
|
||||
sprintf(buf, "%ld second%s", time, time == 1 ? "" : "s");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue