bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] d-ino: avoid false negative on symlink


From: Eric Blake
Subject: [PATCH] d-ino: avoid false negative on symlink
Date: Wed, 21 Aug 2013 16:15:38 -0600

If the first entry listed in a directory is a symlink, we
had a spurious mismatch between d_ino (which should match the
symlink) and stat() results (which chases the symlink).
Reported by Stephane Chazelas <stephane.chazelas AT gmail.com>.

* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Use lstat.

Signed-off-by: Eric Blake <address@hidden>
---

Thanks for the report; pushing this.  Of course, it won't help
findutils until that project resyncs to newer gnulib, but that
will eventually happen; in the meantime, you can configure
with gl_cv_strict_dirent_d_ino=yes to prime the cache and skip
the broken test.

 ChangeLog   | 5 +++++
 m4/d-ino.m4 | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9da8272..1ddabc8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-21  Eric Blake  <address@hidden>
+
+       d-ino: avoid false negative on symlink
+       * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Use lstat.
+
 2013-08-12  Mike Miller  <address@hidden>  (tiny change)

        bootstrap: port to OpenBSD sed
diff --git a/m4/d-ino.m4 b/m4/d-ino.m4
index aab82c2..d093b3f 100644
--- a/m4/d-ino.m4
+++ b/m4/d-ino.m4
@@ -1,4 +1,4 @@
-# serial 13
+# serial 14

 dnl From Jim Meyering.
 dnl
@@ -30,7 +30,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
              e = readdir (dp);
              if (! e)
                return 2;
-             if (stat (e->d_name, &st) != 0)
+             if (lstat (e->d_name, &st) != 0)
                return 3;
              if (e->d_ino != st.st_ino)
                return 4;
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]