1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

linux: Fix time64 support for futimesat

The generic implementation does not support time64 and the default
one return overflow for invalid tv_sec with UTIME_NOW / UTIME_OMIT
(which is valid since tv_sec in such cases is ignored by the
kernel).

Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15
kernel).

Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Adhemerval Zanella
2020-07-10 17:54:42 -03:00
parent cb49c65bb5
commit 01f33a9acc
2 changed files with 6 additions and 54 deletions

View File

@ -36,9 +36,13 @@ __utimensat64_helper (int fd, const char *file,
if (ret == 0 || errno != ENOSYS)
return ret;
/* For UTIME_NOW and UTIME_OMIT the value of tv_sec field is ignored. */
# define TS_VALID(ns) \
((((ns).tv_nsec == UTIME_NOW || (ns).tv_nsec == UTIME_OMIT) \
|| in_time_t_range ((ns).tv_sec)))
if (tsp64 != NULL
&& (! in_time_t_range (tsp64[0].tv_sec)
|| ! in_time_t_range (tsp64[1].tv_sec)))
&& (!TS_VALID (tsp64[0]) || !TS_VALID (tsp64[1])))
{
__set_errno (EOVERFLOW);
return -1;