From: Jim Meyering Date: Wed, 18 Feb 2009 07:37:24 +0000 (+0100) Subject: fts: avoid used-uninitialized error due to recent change X-Git-Tag: v0.1~6315 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=48185e4861122c3ac87476d13d45728797e5ed75;p=gnulib.git fts: avoid used-uninitialized error due to recent change * lib/fts.c (fts_read): Guard uses of the new member, parent->fts_n_dirs_remaining, since it's not relevant for the parent of a directory specified on the command-line. --- diff --git a/ChangeLog b/ChangeLog index 4146057ab..8cbd03bdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-02-18 Jim Meyering + + fts: avoid used-uninitialized error due to recent change + * lib/fts.c (fts_read): Guard uses of the new member, + parent->fts_n_dirs_remaining, since it's not relevant for + the parent of a directory specified on the command-line. + 2009-02-17 James Youngman Bruno Haible diff --git a/lib/fts.c b/lib/fts.c index f00db41bc..0cbb9fb64 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -965,7 +965,10 @@ check_for_dir: if (p->fts_statp->st_size == FTS_STAT_REQUIRED) { FTSENT *parent = p->fts_parent; - if (parent->fts_n_dirs_remaining == 0 + if (FTS_ROOTLEVEL < p->fts_level + /* ->fts_n_dirs_remaining is not valid + for command-line-specified names. */ + && parent->fts_n_dirs_remaining == 0 && ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL) && link_count_optimize_ok (parent)) @@ -975,11 +978,10 @@ check_for_dir: else { p->fts_info = fts_stat(sp, p, false); - if (S_ISDIR(p->fts_statp->st_mode)) - { - if (parent->fts_n_dirs_remaining) + if (S_ISDIR(p->fts_statp->st_mode) + && p->fts_level != FTS_ROOTLEVEL + && parent->fts_n_dirs_remaining) parent->fts_n_dirs_remaining--; - } } } else