diff options
author | bde <bde@FreeBSD.org> | 1995-05-07 07:48:35 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-05-07 07:48:35 +0000 |
commit | c22155de74af576ecb1f3a132137b5caf6b684a8 (patch) | |
tree | 06138be4e7e44daef40ea1981ec0b8fd629f9cc3 /usr.sbin | |
parent | cc1303d7118430fde188a3f00cc06d257fe181d6 (diff) | |
download | FreeBSD-src-c22155de74af576ecb1f3a132137b5caf6b684a8.zip FreeBSD-src-c22155de74af576ecb1f3a132137b5caf6b684a8.tar.gz |
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).
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/edquota/edquota.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index 90bfb85..441df05 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -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); } |