summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2009-10-03 11:45:07 +0200
committerDenys Vlasenko2009-10-03 11:45:07 +0200
commit1d63f046d042bff32501ed0ef503dd77b9ca9b0a (patch)
tree68da358849a26cc1fc491af2d1abdcb175a3c14e /coreutils
parentcae409c6aa2bc649be5a76639b242f672bc2a86e (diff)
downloadbusybox-1d63f046d042bff32501ed0ef503dd77b9ca9b0a.zip
busybox-1d63f046d042bff32501ed0ef503dd77b9ca9b0a.tar.gz
ls: forgotten chunk from prev commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index f841689..a067aa3 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -592,13 +592,15 @@ static void showfiles(struct dnode **dn, unsigned nfiles)
* number of units.
*/
/* by Jorgen Overgaard (jorgen AT antistaten.se) */
-static off_t calculate_blocks(struct dnode **dn, int nfiles)
+static off_t calculate_blocks(struct dnode **dn)
{
uoff_t blocks = 1;
- while (nfiles) {
- blocks += (*dn)->dstat.st_blocks; /* in 512 byte blocks */
- dn++;
- nfiles--;
+ if (dn) {
+ while (*dn) {
+ /* st_blocks is in 512 byte blocks */
+ blocks += (*dn)->dstat.st_blocks;
+ dn++;
+ }
}
/* Even though standard says use 512 byte blocks, coreutils use 1k */