Brooks Davis <[EMAIL PROTECTED]> writes: > In addition to the dump problem I've reported, I'm also seeing issues > with df output. The following is obviously wrong: > > Filesystem 1K-blocks Used Avail Capacity Mounted on > /dev/ad0s2a 254063 -246047 479785 -105% /
Does the attached patch fix the problem? DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED]
Index: df.c =================================================================== RCS file: /home/ncvs/src/bin/df/df.c,v retrieving revision 1.39 diff -u -r1.39 df.c --- df.c 18 May 2002 21:10:40 -0000 1.39 +++ df.c 8 Jun 2002 01:05:08 -0000 @@ -58,6 +58,7 @@ #include <ufs/ufs/ufsmount.h> #include <err.h> #include <math.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -372,7 +373,7 @@ * Attempts to avoid overflow for large filesystems. */ #define fsbtoblk(num, fsbs, bs) \ - (((fsbs) != 0 && (fsbs) < (bs)) ? \ + (intmax_t)(((fsbs) != 0 && (fsbs) < (bs)) ? \ (num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs))) /* @@ -384,7 +385,7 @@ static long blocksize; static int headerlen, timesthrough; static const char *header; - long used, availblks, inodes; + intmax_t used, availblks, inodes; if (++timesthrough == 1) { mwp->mntfrom = imax(mwp->mntfrom, strlen("Filesystem")); @@ -415,7 +416,7 @@ if (hflag) { prthuman(sfsp, used); } else { - (void)printf(" %*ld %*ld %*ld", mwp->total, + (void)printf(" %*jd %*jd %*jd", mwp->total, fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize), mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize), mwp->avail, fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, @@ -426,8 +427,8 @@ if (iflag) { inodes = sfsp->f_files; used = inodes - sfsp->f_ffree; - (void)printf(" %*ld %*ld %4.0f%% ", mwp->iused, used, - mwp->ifree, sfsp->f_ffree, inodes == 0 ? 100.0 : + (void)printf(" %*jd %*jd %4.0f%% ", mwp->iused, used, + mwp->ifree, (intmax_t)sfsp->f_ffree, inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0); } else (void)printf(" ");