diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-12-29 10:20:46 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-01-17 10:57:09 -0300 |
commit | 9fe6f6363886aae6b2b210cae3ed1f5921299083 (patch) | |
tree | d601541a207382c53aa7dfd6ccc256805ec34294 /elf/ldconfig.c | |
parent | cedd498dbc090e39a9b3224f4c53ea98da049f40 (diff) | |
download | glibc-9fe6f6363886aae6b2b210cae3ed1f5921299083.tar.gz glibc-9fe6f6363886aae6b2b210cae3ed1f5921299083.tar.xz glibc-9fe6f6363886aae6b2b210cae3ed1f5921299083.zip |
elf: Fix 64 time_t support for installed statically binaries
The usage of internal static symbol for statically linked binaries does not work correctly for objects built with -D_TIME_BITS=64, since the internal definition does not provide the expected aliases. This patch makes it to use the default stat functions instead (which uses the default 64 time_t alias and types). Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'elf/ldconfig.c')
-rw-r--r-- | elf/ldconfig.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 057c3dd666..d14633f5ec 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -337,7 +337,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ inode data from *ST. */ static struct dir_entry * new_sub_entry (const struct dir_entry *entry, const char *path, - const struct stat64 *st) + const struct stat *st) { struct dir_entry *new_entry = xmalloc (sizeof (struct dir_entry)); new_entry->from_file = entry->from_file; @@ -427,8 +427,8 @@ add_glibc_hwcaps_subdirectories (struct dir_entry *entry, const char *path) continue; /* See if this entry eventually resolves to a directory. */ - struct stat64 st; - if (fstatat64 (dirfd (dir), e->d_name, &st, 0) < 0) + struct stat st; + if (fstatat (dirfd (dir), e->d_name, &st, 0) < 0) /* Ignore unreadable entries. */ continue; @@ -512,8 +512,8 @@ add_dir_1 (const char *line, const char *from_file, int from_line) if (opt_chroot != NULL) path = chroot_canon (opt_chroot, path); - struct stat64 stat_buf; - if (path == NULL || stat64 (path, &stat_buf)) + struct stat stat_buf; + if (path == NULL || stat (path, &stat_buf)) { if (opt_verbose) error (0, errno, _("Can't stat %s"), entry->path); @@ -541,15 +541,15 @@ add_dir (const char *line) } static int -chroot_stat (const char *real_path, const char *path, struct stat64 *st) +chroot_stat (const char *real_path, const char *path, struct stat *st) { int ret; char *canon_path; if (!opt_chroot) - return stat64 (real_path, st); + return stat (real_path, st); - ret = lstat64 (real_path, st); + ret = lstat (real_path, st); if (ret || !S_ISLNK (st->st_mode)) return ret; @@ -557,7 +557,7 @@ chroot_stat (const char *real_path, const char *path, struct stat64 *st) if (canon_path == NULL) return -1; - ret = stat64 (canon_path, st); + ret = stat (canon_path, st); free (canon_path); return ret; } @@ -569,7 +569,7 @@ create_links (const char *real_path, const char *path, const char *libname, { char *full_libname, *full_soname; char *real_full_libname, *real_full_soname; - struct stat64 stat_lib, stat_so, lstat_so; + struct stat stat_lib, stat_so, lstat_so; int do_link = 1; int do_remove = 1; /* XXX: The logics in this function should be simplified. */ @@ -604,7 +604,7 @@ create_links (const char *real_path, const char *path, const char *libname, && stat_lib.st_ino == stat_so.st_ino) /* Link is already correct. */ do_link = 0; - else if (lstat64 (full_soname, &lstat_so) == 0 + else if (lstat (full_soname, &lstat_so) == 0 && !S_ISLNK (lstat_so.st_mode)) { error (0, 0, _("%s is not a symbolic link\n"), full_soname); @@ -612,7 +612,7 @@ create_links (const char *real_path, const char *path, const char *libname, do_remove = 0; } } - else if (lstat64 (real_full_soname, &lstat_so) != 0 + else if (lstat (real_full_soname, &lstat_so) != 0 || !S_ISLNK (lstat_so.st_mode)) /* Unless it is a stale symlink, there is no need to remove. */ do_remove = 0; @@ -656,7 +656,7 @@ manual_link (char *library) char *real_library; char *libname; char *soname; - struct stat64 stat_buf; + struct stat stat_buf; int flag; unsigned int osversion; unsigned int isa_level; @@ -710,7 +710,7 @@ manual_link (char *library) } /* Do some sanity checks first. */ - if (lstat64 (real_library, &stat_buf)) + if (lstat (real_library, &stat_buf)) { error (0, errno, _("Cannot lstat %s"), library); goto out; @@ -885,18 +885,18 @@ search_dir (const struct dir_entry *entry) sprintf (real_file_name, "%s/%s", dir_name, direntry->d_name); } - struct stat64 lstat_buf; + struct stat lstat_buf; /* We optimize and try to do the lstat call only if needed. */ if (direntry->d_type != DT_UNKNOWN) lstat_buf.st_mode = DTTOIF (direntry->d_type); else - if (__glibc_unlikely (lstat64 (real_file_name, &lstat_buf))) + if (__glibc_unlikely (lstat (real_file_name, &lstat_buf))) { error (0, errno, _("Cannot lstat %s"), file_name); continue; } - struct stat64 stat_buf; + struct stat stat_buf; bool is_dir; int is_link = S_ISLNK (lstat_buf.st_mode); if (is_link) @@ -914,7 +914,7 @@ search_dir (const struct dir_entry *entry) continue; } } - if (__glibc_unlikely (stat64 (target_name, &stat_buf))) + if (__glibc_unlikely (stat (target_name, &stat_buf))) { if (opt_verbose) error (0, errno, _("Cannot stat %s"), file_name); @@ -950,7 +950,7 @@ search_dir (const struct dir_entry *entry) { if (!is_link && direntry->d_type != DT_UNKNOWN - && __builtin_expect (lstat64 (real_file_name, &lstat_buf), 0)) + && __builtin_expect (lstat (real_file_name, &lstat_buf), 0)) { error (0, errno, _("Cannot lstat %s"), file_name); continue; @@ -979,10 +979,10 @@ search_dir (const struct dir_entry *entry) else real_name = real_file_name; - /* Call lstat64 if not done yet. */ + /* Call lstat if not done yet. */ if (!is_link && direntry->d_type != DT_UNKNOWN - && __builtin_expect (lstat64 (real_file_name, &lstat_buf), 0)) + && __builtin_expect (lstat (real_file_name, &lstat_buf), 0)) { error (0, errno, _("Cannot lstat %s"), file_name); continue; |