bin/62536: df gives insane numbers when using root-reserved space

Lukas Ertl le at FreeBSD.org
Sat Mar 6 00:46:47 PST 2004


On Sat, 6 Mar 2004, Kris Kennaway wrote:

> On Fri, Mar 05, 2004 at 07:48:48AM -0800, Lukas Ertl wrote:
> > Synopsis: df gives insane numbers when using root-reserved space
> >
> > Responsible-Changed-From-To: freebsd-bugs->le
> > Responsible-Changed-By: le
> > Responsible-Changed-When: Fri Mar 5 07:48:22 PST 2004
> > Responsible-Changed-Why:
> > I probably have a fix for this.
>
> pjd has a patch for this as well..I haven't yet tested it.

Ah, good.

My patch looks like this:

---8<---
Index: bin/df/df.c
===================================================================
RCS file: /home/ncvs/src/bin/df/df.c,v
retrieving revision 1.55
diff -u -r1.55 df.c
--- bin/df/df.c	5 Mar 2004 08:10:16 -0000	1.55
+++ bin/df/df.c	5 Mar 2004 15:51:00 -0000
@@ -400,7 +400,8 @@
  */
 #define fsbtoblk(num, fsbs, bs) \
 	(((fsbs) != 0 && (fsbs) < (bs)) ? \
-		(num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs)))
+		(num) / (int64_t)((bs) / (fsbs)) : \
+		(num) * (int64_t)((fsbs) / (bs)))

 /*
  * Print out status about a file system.
---8<---

cheers,
le

-- 
Lukas Ertl                           http://mailbox.univie.ac.at/~le/
le at FreeBSD.org                       http://people.freebsd.org/~le/


More information about the freebsd-bugs mailing list