(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:
Jim Meyering committed 2003-02-20 15:03:22 +00:00
1 parent c023e74aac
commit 5c629d9ef4
1 file changed
+9 -6
+9 -6
View File
@@ -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;