mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 15:00:06 +00:00
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:
parent
220622dde5
commit
b03688bfbb
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user