aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-03-02 17:06:02 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-06-22 12:09:52 -0300
commit52a5fe70a2c77935afe807fb6e904e512ddd894e (patch)
treee17476a3ebc60b2e00aea93f24227199caaee8d4 /io
parenta318262bc0081ab83e3f3c90e50462f99148605e (diff)
downloadglibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.tar
glibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.tar.gz
glibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.tar.bz2
glibc-52a5fe70a2c77935afe807fb6e904e512ddd894e.zip
Use 64 bit time_t stat internally
For the legacy ABI with supports 32-bit time_t it calls the 64-bit time directly, since the LFS symbols calls the 64-bit time_t ones internally. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'io')
-rw-r--r--io/Makefile4
-rw-r--r--io/file_change_detection.c10
-rw-r--r--io/getdirname.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/io/Makefile b/io/Makefile
index ba8bd37355..1a16990205 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -69,7 +69,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-posix_fallocate tst-posix_fallocate64 \
tst-fts tst-fts-lfs tst-open-tmpfile \
tst-copy_file_range tst-getcwd-abspath tst-lockf \
- tst-ftw-lnk tst-file_change_detection tst-lchmod \
+ tst-ftw-lnk tst-lchmod \
tst-ftw-bz26353 tst-stat tst-stat-lfs \
tst-utime \
tst-utimes \
@@ -90,7 +90,7 @@ tests-time64 := \
tst-utimes-time64 \
# Likewise for statx, but we do not need static linking here.
-tests-internal += tst-statx
+tests-internal += tst-statx tst-file_change_detection
tests-static += tst-statx
ifeq ($(run-built-tests),yes)
diff --git a/io/file_change_detection.c b/io/file_change_detection.c
index 9871bc9166..fad0907223 100644
--- a/io/file_change_detection.c
+++ b/io/file_change_detection.c
@@ -44,7 +44,7 @@ libc_hidden_def (__file_is_unchanged)
void
__file_change_detection_for_stat (struct file_change_detection *file,
- const struct stat64 *st)
+ const struct __stat64_t64 *st)
{
if (S_ISDIR (st->st_mode))
/* Treat as empty file. */
@@ -66,8 +66,8 @@ bool
__file_change_detection_for_path (struct file_change_detection *file,
const char *path)
{
- struct stat64 st;
- if (__stat64 (path, &st) != 0)
+ struct __stat64_t64 st;
+ if (__stat64_time64 (path, &st) != 0)
switch (errno)
{
case EACCES:
@@ -104,8 +104,8 @@ __file_change_detection_for_fp (struct file_change_detection *file,
}
else
{
- struct stat64 st;
- if (__fstat64 (__fileno (fp), &st) != 0)
+ struct __stat64_t64 st;
+ if (__fstat64_time64 (__fileno (fp), &st) != 0)
/* If we already have a file descriptor, all errors are fatal. */
return false;
else
diff --git a/io/getdirname.c b/io/getdirname.c
index 32b5ab4b6c..f29e910b37 100644
--- a/io/getdirname.c
+++ b/io/getdirname.c
@@ -28,12 +28,12 @@ char *
get_current_dir_name (void)
{
char *pwd;
- struct stat64 dotstat, pwdstat;
+ struct __stat64_t64 dotstat, pwdstat;
pwd = getenv ("PWD");
if (pwd != NULL
- && __stat64 (".", &dotstat) == 0
- && __stat64 (pwd, &pwdstat) == 0
+ && __stat64_time64 (".", &dotstat) == 0
+ && __stat64_time64 (pwd, &pwdstat) == 0
&& pwdstat.st_dev == dotstat.st_dev
&& pwdstat.st_ino == dotstat.st_ino)
/* The PWD value is correct. Use it. */