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.
This commit is contained in:
Adhemerval Zanella 2020-01-02 15:39:12 -03:00
parent 220622dde5
commit b03688bfbb

View File

@ -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, r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id,
flags, req, rem); flags, req, rem);
if (r != -ENOSYS) if (! INTERNAL_SYSCALL_ERROR_P (r, err))
return (INTERNAL_SYSCALL_ERROR_P (r, err) return 0;
? INTERNAL_SYSCALL_ERRNO (r, err) : 0); if (INTERNAL_SYSCALL_ERRNO (r, err) != ENOSYS)
return INTERNAL_SYSCALL_ERRNO (r, err);
# endif /* __NR_clock_nanosleep_time64 */ # endif /* __NR_clock_nanosleep_time64 */
if (! in_time_t_range (req->tv_sec)) if (! in_time_t_range (req->tv_sec))
@ -67,9 +68,12 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec
struct timespec ts32 = valid_timespec64_to_timespec (*req); struct timespec ts32 = valid_timespec64_to_timespec (*req);
r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags, r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags,
&ts32, &tr32); &ts32, &tr32);
if (INTERNAL_SYSCALL_ERROR_P (r, err))
if (r == -EINTR && rem != NULL && (flags & TIMER_ABSTIME) == 0) {
if (INTERNAL_SYSCALL_ERRNO (r, err) == EINTR && rem != NULL
&& (flags & TIMER_ABSTIME) == 0)
*rem = valid_timespec_to_timespec64 (tr32); *rem = valid_timespec_to_timespec64 (tr32);
}
#endif /* __ASSUME_TIME64_SYSCALLS */ #endif /* __ASSUME_TIME64_SYSCALLS */
return (INTERNAL_SYSCALL_ERROR_P (r, err) return (INTERNAL_SYSCALL_ERROR_P (r, err)