]> sourceware.org Git - glibc.git/commitdiff
Use LFS readdir in generic POSIX getcwd [BZ# 22899]
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 25 Aug 2020 20:22:09 +0000 (17:22 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 2 Sep 2020 12:16:05 +0000 (09:16 -0300)
Checked on x86_64-linux-gnu and i686-linux-gnu.

sysdeps/posix/getcwd.c
sysdeps/unix/sysv/linux/readdir64.c

index e466a4a8bf8f6619747086683db05fad648cc7ad..066aab7de7f53fbd8e05eab29944a663ba464091 100644 (file)
 # define __lstat64 lstat
 # define __closedir closedir
 # define __opendir opendir
-# define __readdir readdir
+# define __readdir64 readdir
 # define __fdopendir fdopendir
 # define __openat openat
 # define __rewinddir rewinddir
 # define __openat64 openat
+# define dirent64 dirent
 #else
 # include <not-cancel.h>
 #endif
@@ -260,7 +261,7 @@ __getcwd_generic (char *buf, size_t size)
 
   while (!(thisdev == rootdev && thisino == rootino))
     {
-      struct dirent *d;
+      struct dirent64 *d;
       dev_t dotdev;
       ino_t dotino;
       bool mount_point;
@@ -313,7 +314,7 @@ __getcwd_generic (char *buf, size_t size)
           /* Clear errno to distinguish EOF from error if readdir returns
              NULL.  */
           __set_errno (0);
-          d = __readdir (dirstream);
+          d = __readdir64 (dirstream);
 
           /* When we've iterated through all directory entries without finding
              one with a matching d_ino, rewind the stream and consider each
@@ -326,7 +327,7 @@ __getcwd_generic (char *buf, size_t size)
             {
               use_d_ino = false;
               __rewinddir (dirstream);
-              d = __readdir (dirstream);
+              d = __readdir64 (dirstream);
             }
 
           if (d == NULL)
index 7d4b0001b3a211b8f23c2ed0b8e9b8c3b812469e..170a889c519f126f323be3ef285b47121ab105af 100644 (file)
@@ -42,7 +42,11 @@ weak_alias (__readdir64, readdir)
 /* The compat code expects the 'struct direct' with d_ino being a __ino_t
    instead of __ino64_t.  */
 # include <shlib-compat.h>
+# if IS_IN(rtld)
+weak_alias (__readdir64, readdir64)
+# else
 versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
+# endif
 # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
 #  include <olddirent.h>
 #  define __READDIR   attribute_compat_text_section __old_readdir64
This page took 0.050557 seconds and 5 git commands to generate.