From 04986243d1af37ac0177ed2f9db0a066ebd2b212 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 15 Jul 2020 19:35:58 +0000 Subject: Remove internal usage of extensible stat functions It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- elf/cache.c | 4 ++-- elf/dl-load.c | 4 ++-- elf/dl-misc.c | 2 +- elf/dl-profile.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'elf') diff --git a/elf/cache.c b/elf/cache.c index d92b4e5..1eb1455 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -163,7 +163,7 @@ print_cache (const char *cache_name) error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), cache_name); struct stat64 st; - if (fstat64 (fd, &st) < 0 + if (__fstat64 (fd, &st) < 0 /* No need to map the file if it is empty. */ || st.st_size == 0) { @@ -699,7 +699,7 @@ load_aux_cache (const char *aux_cache_name) } struct stat64 st; - if (fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file)) + if (__fstat64 (fd, &st) < 0 || st.st_size < sizeof (struct aux_cache_file)) { close (fd); init_aux_cache (); diff --git a/elf/dl-load.c b/elf/dl-load.c index e39980f..646c5dc 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1914,7 +1914,7 @@ open_path (const char *name, size_t namelen, int mode, buf[buflen - namelen - 1] = '\0'; - if (__xstat64 (_STAT_VER, buf, &st) != 0 + if (__stat64 (buf, &st) != 0 || ! S_ISDIR (st.st_mode)) /* The directory does not exist or it is no directory. */ this_dir->status[cnt] = nonexisting; @@ -1934,7 +1934,7 @@ open_path (const char *name, size_t namelen, int mode, directories and so exploit the bugs. */ struct stat64 st; - if (__fxstat64 (_STAT_VER, fd, &st) != 0 + if (__fstat64 (fd, &st) != 0 || (st.st_mode & S_ISUID) == 0) { /* The shared object cannot be tested for being SUID diff --git a/elf/dl-misc.c b/elf/dl-misc.c index f9d1fd7..aee62e1 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -47,7 +47,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) int fd = __open64_nocancel (file, O_RDONLY | O_CLOEXEC); if (fd >= 0) { - if (__fxstat64 (_STAT_VER, fd, &st) >= 0) + if (__fstat64 (fd, &st) >= 0) { *sizep = st.st_size; diff --git a/elf/dl-profile.c b/elf/dl-profile.c index c681f54..89dd70b 100644 --- a/elf/dl-profile.c +++ b/elf/dl-profile.c @@ -342,7 +342,7 @@ _dl_start_profile (void) return; } - if (__fxstat64 (_STAT_VER, fd, &st) < 0 || !S_ISREG (st.st_mode)) + if (__fstat64 (fd, &st) < 0 || !S_ISREG (st.st_mode)) { /* Not stat'able or not a regular file => don't use it. */ errstr = "%s: cannot stat file: %s\n"; -- cgit v1.1