mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
(process_file): Set info->skip before any possible return.
Report correct usage for directories, not 0. (process_file): Return for `file_type == FTW_DPRE' _before_ recording the dev/ino of a directory.
This commit is contained in:
1 parent
c023e74aac
commit
5c629d9ef4
1 file changed
+9
-6
@@ -329,6 +329,9 @@ process_file (const char *file, const struct stat *sb, int file_type,
|
||||
directory at the specified level. */
|
||||
static uintmax_t *sum_subdir;
|
||||
|
||||
/* Always define info->skip before returning. */
|
||||
info->skip = excluded_filename (exclude, file + info->base);
|
||||
|
||||
switch (file_type)
|
||||
{
|
||||
case FTW_NS:
|
||||
@@ -360,9 +363,14 @@ process_file (const char *file, const struct stat *sb, int file_type,
|
||||
break;
|
||||
}
|
||||
|
||||
/* If this is the first (pre-order) encounter with a directory,
|
||||
return right away. */
|
||||
if (file_type == FTW_DPRE)
|
||||
return 0;
|
||||
|
||||
/* 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))
|
||||
if (info->skip
|
||||
|| (!opt_count_all
|
||||
&& 1 < sb->st_nlink
|
||||
&& hash_ins (sb->st_ino, sb->st_dev)))
|
||||
@@ -377,11 +385,6 @@ process_file (const char *file, const struct stat *sb, int file_type,
|
||||
s = size = ST_NBLOCKS (*sb);
|
||||
}
|
||||
|
||||
/* If this is the first (pre-order) encounter with a directory,
|
||||
return right away. */
|
||||
if (file_type == FTW_DPRE)
|
||||
return 0;
|
||||
|
||||
if (first_call)
|
||||
{
|
||||
n_alloc = info->level + 10;
|
||||
|
||||
Reference in new issue
Block a user