]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(fts_stat): When following a symlink-to-directory,
authorJim Meyering <jim@meyering.net>
Wed, 11 Jan 2006 21:00:36 +0000 (21:00 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 11 Jan 2006 21:00:36 +0000 (21:00 +0000)
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

index 6cf393c0077295172c07c65519372b3c72df46a1..ba7ea44543f9e993ea283032ae8726638684a279 100644 (file)
--- 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);
                        }