about summary refs log tree commit diff
path: root/sysdeps/posix/getcwd.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-08-25 17:22:09 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-09-02 09:16:05 -0300
commit804200923df4f40dbde09ea708869d252caba288 (patch)
tree1d1b6560774eb7c7f92953d2bc0040e2068375d8 /sysdeps/posix/getcwd.c
parentbbedd75c41ff801c7606bbaf1b7bdfc45d3f45a5 (diff)
downloadglibc-804200923df4f40dbde09ea708869d252caba288.tar.gz
glibc-804200923df4f40dbde09ea708869d252caba288.tar.xz
glibc-804200923df4f40dbde09ea708869d252caba288.zip
Use LFS readdir in generic POSIX getcwd [BZ# 22899]
Checked on x86_64-linux-gnu and i686-linux-gnu.
Diffstat (limited to 'sysdeps/posix/getcwd.c')
-rw-r--r--sysdeps/posix/getcwd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index e466a4a8bf..066aab7de7 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -97,11 +97,12 @@
 # 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)