mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Use LFS readdir in generic POSIX getcwd [BZ# 22899]
Checked on x86_64-linux-gnu and i686-linux-gnu.
This commit is contained in:
@ -97,11 +97,12 @@
|
|||||||
# define __lstat64 lstat
|
# define __lstat64 lstat
|
||||||
# define __closedir closedir
|
# define __closedir closedir
|
||||||
# define __opendir opendir
|
# define __opendir opendir
|
||||||
# define __readdir readdir
|
# define __readdir64 readdir
|
||||||
# define __fdopendir fdopendir
|
# define __fdopendir fdopendir
|
||||||
# define __openat openat
|
# define __openat openat
|
||||||
# define __rewinddir rewinddir
|
# define __rewinddir rewinddir
|
||||||
# define __openat64 openat
|
# define __openat64 openat
|
||||||
|
# define dirent64 dirent
|
||||||
#else
|
#else
|
||||||
# include <not-cancel.h>
|
# include <not-cancel.h>
|
||||||
#endif
|
#endif
|
||||||
@ -260,7 +261,7 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
|
|
||||||
while (!(thisdev == rootdev && thisino == rootino))
|
while (!(thisdev == rootdev && thisino == rootino))
|
||||||
{
|
{
|
||||||
struct dirent *d;
|
struct dirent64 *d;
|
||||||
dev_t dotdev;
|
dev_t dotdev;
|
||||||
ino_t dotino;
|
ino_t dotino;
|
||||||
bool mount_point;
|
bool mount_point;
|
||||||
@ -313,7 +314,7 @@ __getcwd_generic (char *buf, size_t size)
|
|||||||
/* Clear errno to distinguish EOF from error if readdir returns
|
/* Clear errno to distinguish EOF from error if readdir returns
|
||||||
NULL. */
|
NULL. */
|
||||||
__set_errno (0);
|
__set_errno (0);
|
||||||
d = __readdir (dirstream);
|
d = __readdir64 (dirstream);
|
||||||
|
|
||||||
/* When we've iterated through all directory entries without finding
|
/* When we've iterated through all directory entries without finding
|
||||||
one with a matching d_ino, rewind the stream and consider each
|
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;
|
use_d_ino = false;
|
||||||
__rewinddir (dirstream);
|
__rewinddir (dirstream);
|
||||||
d = __readdir (dirstream);
|
d = __readdir64 (dirstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
|
@ -42,7 +42,11 @@ weak_alias (__readdir64, readdir)
|
|||||||
/* The compat code expects the 'struct direct' with d_ino being a __ino_t
|
/* The compat code expects the 'struct direct' with d_ino being a __ino_t
|
||||||
instead of __ino64_t. */
|
instead of __ino64_t. */
|
||||||
# include <shlib-compat.h>
|
# include <shlib-compat.h>
|
||||||
|
# if IS_IN(rtld)
|
||||||
|
weak_alias (__readdir64, readdir64)
|
||||||
|
# else
|
||||||
versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
|
versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
|
||||||
|
# endif
|
||||||
# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
|
# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
|
||||||
# include <olddirent.h>
|
# include <olddirent.h>
|
||||||
# define __READDIR attribute_compat_text_section __old_readdir64
|
# define __READDIR attribute_compat_text_section __old_readdir64
|
||||||
|
Reference in New Issue
Block a user