diff options
author | David Schultz <das@FreeBSD.org> | 2004-06-08 09:27:42 +0000 |
---|---|---|
committer | David Schultz <das@FreeBSD.org> | 2004-06-08 09:27:42 +0000 |
commit | 48a91b69b8d2b72381705e4fd420f0fe0938db32 (patch) | |
tree | ac68cdb05faaeadc517972c752b7541a6dd4650f /bin/ls | |
parent | 429fa51d7cc01ec745bab5edad862dbdf3ccfedd (diff) | |
download | src-48a91b69b8d2b72381705e4fd420f0fe0938db32.tar.gz src-48a91b69b8d2b72381705e4fd420f0fe0938db32.zip |
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.
Notes
Notes:
svn path=/head/; revision=130236
Diffstat (limited to 'bin/ls')
-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 3e57b374249a..075cc5f13034 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) { |