From 7ed2b6921feb51d3fecdd0b72e8ab7a7f37ba4ae Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Thu, 12 Nov 2020 12:24:04 +0100 Subject: nanosleep: Pass NULL when rem == NULL on ports with __TIMESIZE != 64 On ports with __TIMESIZE != 64 the remaining time argument always receives pointer to struct __timespec64 instance. This is the different behavior when compared to 64 bit versions of clock_nanosleep and nanosleep functions, which receive NULL. To avoid any potential issues, we also pass NULL when *rem pointer is NULL. Reported-by: Andreas Schwab Reviewed-by: Alistair Francis --- sysdeps/unix/sysv/linux/nanosleep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/unix/sysv/linux/nanosleep.c') diff --git a/sysdeps/unix/sysv/linux/nanosleep.c b/sysdeps/unix/sysv/linux/nanosleep.c index 8f4ee0f744..e58815c4d0 100644 --- a/sysdeps/unix/sysv/linux/nanosleep.c +++ b/sysdeps/unix/sysv/linux/nanosleep.c @@ -39,7 +39,7 @@ __nanosleep (const struct timespec *req, struct timespec *rem) struct __timespec64 treq64, trem64; treq64 = valid_timespec_to_timespec64 (*req); - int ret = __nanosleep64 (&treq64, &trem64); + int ret = __nanosleep64 (&treq64, rem != NULL ? &trem64 : NULL); if (ret != 0 && errno == EINTR && rem != NULL) *rem = valid_timespec64_to_timespec (trem64); -- cgit 1.4.1