From: Jim Meyering Date: Wed, 11 Jan 2006 21:00:36 +0000 (+0000) Subject: (fts_stat): When following a symlink-to-directory, X-Git-Tag: v6.0~911 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf6281916bdc0d518887392240dfa26690385815;p=thirdparty%2Fcoreutils.git (fts_stat): When following a symlink-to-directory, don't interpret all stat-fails+lstat-succeeds as indicating a dangling symlink. That can also happen at least for ELOOP. The fix: return FTS_SLNONE only when the stat errno is ENOENT. --- diff --git a/lib/fts.c b/lib/fts.c index 6cf393c007..ba7ea44543 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -1069,7 +1069,8 @@ fts_stat(FTS *sp, register FTSENT *p, bool follow) if (ISSET(FTS_LOGICAL) || follow) { if (stat(p->fts_accpath, sbp)) { saved_errno = errno; - if (!lstat(p->fts_accpath, sbp)) { + if (errno == ENOENT + && lstat(p->fts_accpath, sbp) == 0) { __set_errno (0); return (FTS_SLNONE); }