d-ino: avoid false negative on symlink
authorEric Blake <eblake@redhat.com>
Wed, 21 Aug 2013 22:10:18 +0000 (16:10 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 21 Aug 2013 22:16:27 +0000 (16:16 -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@gmail.com>.

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

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
m4/d-ino.m4

index 9da8272..a5803ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-21  Eric Blake  <eblake@redhat.com>
+
+       d-ino: avoid false negative on symlink
+       * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Use lstat.
+       Reported by Stephane Chazelas.
+
 2013-08-12  Mike Miller  <mtmiller@ieee.org>  (tiny change)
 
        bootstrap: port to OpenBSD sed
index aab82c2..d093b3f 100644 (file)
@@ -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;