summaryrefslogtreecommitdiff
path: root/usr.bin/du/du.c
diff options
context:
space:
mode:
authorIgor Sobrado <sobrado@cvs.openbsd.org>2011-04-27 07:52:12 +0000
committerIgor Sobrado <sobrado@cvs.openbsd.org>2011-04-27 07:52:12 +0000
commit30465e483a69f8410f67cd560c84579669b24bcd (patch)
tree89026e7871150b754fca2a670447233d184c5753 /usr.bin/du/du.c
parent999d04b476e6c635bb75bffd63d6e96b3cc1d28f (diff)
cast one blocksize occurrence to unsigned long, fixes du(1)'s output
for directories larger than one terabyte; while here, wrap a long line. problem found by Chano Antuna and diff written with lots of good advice from millert@, thanks! ok millert@
Diffstat (limited to 'usr.bin/du/du.c')
-rw-r--r--usr.bin/du/du.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index bb1bdee93b2..3a04897c19a 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: du.c,v 1.22 2009/10/27 23:59:37 deraadt Exp $ */
+/* $OpenBSD: du.c,v 1.23 2011/04/27 07:52:11 sobrado Exp $ */
/* $NetBSD: du.c,v 1.11 1996/10/18 07:20:35 thorpej Exp $ */
/*
@@ -173,8 +173,9 @@ main(int argc, char *argv[])
*/
if (listdirs ||
(!listfiles && p->fts_level == FTS_ROOTLEVEL)) {
- prtout((quad_t)howmany(p->fts_number, blocksize),
- p->fts_path, hflag);
+ prtout((quad_t)howmany(p->fts_number,
+ (unsigned long)blocksize), p->fts_path,
+ hflag);
}
break;
case FTS_DC: /* Ignore. */
@@ -193,8 +194,8 @@ main(int argc, char *argv[])
* the root of a traversal, display the total.
*/
if (listfiles || p->fts_level == FTS_ROOTLEVEL)
- prtout(howmany(p->fts_statp->st_blocks, blocksize),
- p->fts_path, hflag);
+ prtout(howmany(p->fts_statp->st_blocks,
+ blocksize), p->fts_path, hflag);
p->fts_parent->fts_number += p->fts_statp->st_blocks;
if (cflag)
totalblocks += p->fts_statp->st_blocks;