diff options
author | Jim Meyering <jim@meyering.net> | 2003-02-06 08:14:01 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-02-06 08:14:01 +0000 |
commit | a47615d2edb09249b58fa89628925d53cd33a658 (patch) | |
tree | 0b227831fee4e302e01d53017d5019d326796f72 | |
parent | 505f652d9e8a40b5bad1d3df09b4ed5ecc33d19f (diff) | |
download | coreutils-a47615d2edb09249b58fa89628925d53cd33a658.tar.xz |
(process_file): Don't return early for excluded files
or for files whose dev/inode we've already seen.
-rw-r--r-- | src/du.c | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -359,16 +359,28 @@ process_file (const char *file, const struct stat *sb, int file_type, break; } - if (!opt_count_all - && 1 < sb->st_nlink - && hash_ins (sb->st_ino, sb->st_dev)) - return 0; /* Have counted this already. */ + /* If the file is being excluded or if it has already been counted + via a hard link, then don't let it contribute to the sums. */ + if ((info->skip = excluded_filename (exclude, file + info->base)) + || (!opt_count_all + && 1 < sb->st_nlink + && hash_ins (sb->st_ino, sb->st_dev))) + { + /* Note that we must not simply return here. + We still have to update prev_level and maybe propagate + some sums up the hierarchy. */ + s = size = 0; + } + else + { + s = size = ST_NBLOCKS (*sb); + } - if (excluded_filename (exclude, file + info->base)) + /* If this is the first (pre-order) encounter with a directory, + return right away. */ + if (file_type == FTW_DPRE) return 0; - s = size = ST_NBLOCKS (*sb); - if (first_call) { n_alloc = info->level + 10; |