diff options
author | das <das@FreeBSD.org> | 2004-06-08 09:27:42 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2004-06-08 09:27:42 +0000 |
commit | 03b595604e8ecb0df9c45b98ff40642cb6b3cf93 (patch) | |
tree | ac68cdb05faaeadc517972c752b7541a6dd4650f /bin | |
parent | 3bf7b1e476c4c2e4cb70762cb5eb2e139b7cae66 (diff) | |
download | FreeBSD-src-03b595604e8ecb0df9c45b98ff40642cb6b3cf93.zip FreeBSD-src-03b595604e8ecb0df9c45b98ff40642cb6b3cf93.tar.gz |
Remove from the printfns the assumption that dp->list != NULL. Even
if there are no entries, these functions may be called to print the
total number of blocks (0) for consistency's sake.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ls/print.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c index 3e57b37..075cc5f 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -142,8 +142,10 @@ printlong(const DISPLAY *dp) int haveacls; dev_t prevdev; - if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size)) + if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && + (f_longform || f_size)) { (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); + } haveacls = 1; prevdev = (dev_t)-1; @@ -294,8 +296,10 @@ printcol(const DISPLAY *dp) if (num % numcols) ++numrows; - if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size)) + if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && + (f_longform || f_size)) { (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); + } base = 0; for (row = 0; row < numrows; ++row) { |