This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix for BZ#12165


Greetings,

Here is a proposed patch for BZ#12165 to stop libc from treating d_ino==0
as special.

Tested on x86_64 (a bunch of NPTL tests, e.g. nptl/tst-mutex8,
nptl/tst-mutexpi8, nptl/tst-cond8 failed for me, for apparently unrelated
reasons).

Thanks,
--
Paul Pluzhnikov

2010-11-01  Paul Pluzhnikov  <ppluzhnikov@google.com>

	    BZ#12165

	    * posix/glob.c (REAL_DIR_ENTRY): Delete macro.
	    (glob_in_dir): Don't reference it.
	    * sysdeps/unix/readdir.c (__READDIR): do not treat d_ino==0
	    as special.
	    * sysdeps/unix/readdir_r.c (__READDIR_R): Likewise.


diff --git a/posix/glob.c b/posix/glob.c
index 6df083a..960b5ed 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -129,15 +129,6 @@
   CONVERT_D_TYPE (d64, d32)
 #endif
 
-
-#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
-/* Posix does not require that the d_ino field be present, and some
-   systems do not provide it. */
-# define REAL_DIR_ENTRY(dp) 1
-#else
-# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
-#endif /* POSIX */
-
 #include <stdlib.h>
 #include <string.h>
 
@@ -1384,8 +1375,6 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
 #endif
 	      if (d == NULL)
 		break;
-	      if (! REAL_DIR_ENTRY (d))
-		continue;
 
 	      /* If we shall match only directories use the information
 		 provided by the dirent call if possible.  */
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index 13e5e9a..69a709e 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -107,9 +107,7 @@ __READDIR (DIR *dirp)
 #else
       dirp->filepos += reclen;
 #endif
-
-      /* Skip deleted files.  */
-    } while (dp->d_ino == 0);
+    } while (0);
 
 #ifndef NOT_IN_libc
   __libc_lock_unlock (dirp->lock);
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
index 9372791..c9b03dc 100644
--- a/sysdeps/unix/readdir_r.c
+++ b/sysdeps/unix/readdir_r.c
@@ -107,10 +107,8 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
 #else
       dirp->filepos += reclen;
 #endif
-
-      /* Skip deleted files.  */
     }
-  while (dp->d_ino == 0);
+  while (0);
 
   if (dp != NULL)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]