diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c index 8d2fed366e..2411ce1e6e 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c @@ -19,10 +19,29 @@ #include #include #include +#include #if !XSTAT_IS_XSTAT64 # include +static inline bool +in_time_t_range (__time64_t t) +{ + time_t s = t; + return s == t; +} + +static inline struct timespec +valid_timespec64_to_timespec (const struct __timespec64 ts64) +{ + struct timespec ts; + + ts.tv_sec = (time_t) ts64.tv_sec; + ts.tv_nsec = ts64.tv_nsec; + + return ts; +} + int __fstatat (int fd, const char *file, struct stat *buf, int flag) { diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c index f968e4ef05..67801af2fd 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c @@ -53,8 +53,8 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf, return r; *buf = (struct __stat64_t64) { - .st_dev = __gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor), - .st_rdev = __gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor), + .st_dev = gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor), + .st_rdev = gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor), .st_ino = tmp.stx_ino, .st_mode = tmp.stx_mode, .st_nlink = tmp.stx_nlink, @@ -74,6 +74,17 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf, return r; } +static inline struct __timespec64 +valid_timespec_to_timespec64 (const struct timespec ts) +{ + struct __timespec64 ts64; + + ts64.tv_sec = ts.tv_sec; + ts64.tv_nsec = ts.tv_nsec; + + return ts64; +} + static inline int fstatat64_time64_stat (int fd, const char *file, struct __stat64_t64 *buf, int flag)