From cf6281916bdc0d518887392240dfa26690385815 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 11 Jan 2006 21:00:36 +0000 Subject: [PATCH] (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. --- lib/fts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fts.c b/lib/fts.c index 6cf393c..ba7ea44 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); } -- 2.7.4