summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2009-08-27 11:29:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2009-08-27 11:29:31 +0000
commitc787cab6e4f8071a46be007944733bb4e5e4cf39 (patch)
tree5531f4f979cdccdc82f85a34c2728ba64bb71d6c /usr.bin
parent34b0e3fe60ea380b04673d7b94589adc994daca4 (diff)
Use FTS_ROOTLEVEL instead of 0 when checking fts_level.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/du/du.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 24306bb6ee5..e1f816b041a 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: du.c,v 1.20 2009/06/03 15:15:16 millert Exp $ */
+/* $OpenBSD: du.c,v 1.21 2009/08/27 11:29:30 millert Exp $ */
/* $NetBSD: du.c,v 1.11 1996/10/18 07:20:35 thorpej Exp $ */
/*
@@ -43,7 +43,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95";
#else
-static const char rcsid[] = "$OpenBSD: du.c,v 1.20 2009/06/03 15:15:16 millert Exp $";
+static const char rcsid[] = "$OpenBSD: du.c,v 1.21 2009/08/27 11:29:30 millert Exp $";
#endif
#endif /* not lint */
@@ -185,9 +185,11 @@ main(int argc, char *argv[])
* or directories and this is post-order of the
* root of a traversal, display the total.
*/
- if (listdirs || (!listfiles && !p->fts_level))
+ if (listdirs ||
+ (!listfiles && p->fts_level == FTS_ROOTLEVEL)) {
prtout((quad_t)howmany(p->fts_number, blocksize),
p->fts_path, hflag);
+ }
break;
case FTS_DC: /* Ignore. */
break;
@@ -204,7 +206,7 @@ main(int argc, char *argv[])
* If listing each file, or a non-directory file was
* the root of a traversal, display the total.
*/
- if (listfiles || !p->fts_level)
+ if (listfiles || p->fts_level == FTS_ROOTLEVEL)
prtout(howmany(p->fts_statp->st_blocks, blocksize),
p->fts_path, hflag);
p->fts_parent->fts_number += p->fts_statp->st_blocks;