diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-01-02 15:39:12 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-01-03 10:02:05 -0300 |
commit | b03688bfbb072f42970747bc2e6362c24b4b7ee8 (patch) | |
tree | 46604ee4bf56a8f38206b049b8e57817c6c00ea6 /sysdeps/unix/sysv/linux/clock_nanosleep.c | |
parent | 220622dde5704c95a100c2792a280f18f3deba73 (diff) | |
download | glibc-b03688bfbb072f42970747bc2e6362c24b4b7ee8.tar.gz glibc-b03688bfbb072f42970747bc2e6362c24b4b7ee8.tar.xz glibc-b03688bfbb072f42970747bc2e6362c24b4b7ee8.zip |
Linux: Fix clock_nanosleep time64 check
The result of INTERNAL_SYSCALL_CANCEL should be checked with macros INTERNAL_SYSCALL_ERROR_P and INTERNAL_SYSCALL_ERRNO instead of comparing the result directly. Checked on powerpc-linux-gnu.
Diffstat (limited to 'sysdeps/unix/sysv/linux/clock_nanosleep.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/clock_nanosleep.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c index 993c3cc8a6..728137aa56 100644 --- a/sysdeps/unix/sysv/linux/clock_nanosleep.c +++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c @@ -52,9 +52,10 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id, flags, req, rem); - if (r != -ENOSYS) - return (INTERNAL_SYSCALL_ERROR_P (r, err) - ? INTERNAL_SYSCALL_ERRNO (r, err) : 0); + if (! INTERNAL_SYSCALL_ERROR_P (r, err)) + return 0; + if (INTERNAL_SYSCALL_ERRNO (r, err) != ENOSYS) + return INTERNAL_SYSCALL_ERRNO (r, err); # endif /* __NR_clock_nanosleep_time64 */ if (! in_time_t_range (req->tv_sec)) @@ -65,11 +66,14 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec struct timespec tr32; struct timespec ts32 = valid_timespec64_to_timespec (*req); - r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags, - &ts32, &tr32); - - if (r == -EINTR && rem != NULL && (flags & TIMER_ABSTIME) == 0) - *rem = valid_timespec_to_timespec64 (tr32); + r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags, + &ts32, &tr32); + if (INTERNAL_SYSCALL_ERROR_P (r, err)) + { + if (INTERNAL_SYSCALL_ERRNO (r, err) == EINTR && rem != NULL + && (flags & TIMER_ABSTIME) == 0) + *rem = valid_timespec_to_timespec64 (tr32); + } #endif /* __ASSUME_TIME64_SYSCALLS */ return (INTERNAL_SYSCALL_ERROR_P (r, err) |