summaryrefslogtreecommitdiff
path: root/lib/fts.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-01-11 21:00:36 +0000
committerJim Meyering <jim@meyering.net>2006-01-11 21:00:36 +0000
commitcf6281916bdc0d518887392240dfa26690385815 (patch)
tree864a92e626e88d772d93df027d06a3592b294488 /lib/fts.c
parente51c87a60401c1738dcbfa92d5f8c8c36a6b6043 (diff)
downloadcoreutils-cf6281916bdc0d518887392240dfa26690385815.tar.xz
(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.
Diffstat (limited to 'lib/fts.c')
-rw-r--r--lib/fts.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/fts.c b/lib/fts.c
index 6cf393c00..ba7ea4454 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);
}