Mercurial > hg > octave-kai > gnulib-hg
changeset 11171:5be124843f38
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.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Wed, 18 Feb 2009 08:37:24 +0100 |
parents | 2d75ece3de5b |
children | 06f09c5ed316 |
files | ChangeLog lib/fts.c |
diffstat | 2 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-02-18 Jim Meyering <meyering@redhat.com> + + 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 <jay@gnu.org> Bruno Haible <bruno@clisp.org>
--- a/lib/fts.c +++ b/lib/fts.c @@ -965,7 +965,10 @@ 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 @@ 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