diff mbox series

[uclibc-ng-devel,2/2] librt: avoid compilation error

Message ID 20200909071804.35932-3-damien.lemoal@wdc.com
State Accepted
Headers show
Series Fix compilation errors | expand

Commit Message

Damien Le Moal Sept. 9, 2020, 7:18 a.m. UTC
For NOMMU builds, LIBC_CANCEL_ASYNC and LIBC_CANCEL_RESET are not
defined. Prevent these macros from being visible by the compiler in
clock_nanosleep() by replacing "if (SINGLE_THREAD_P) {" with the
pre-compiler directive "#if defined(SINGLE_THREAD_P)".

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 librt/clock_nanosleep.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/librt/clock_nanosleep.c b/librt/clock_nanosleep.c
index 4cf1e06b4..1515cf5b0 100644
--- a/librt/clock_nanosleep.c
+++ b/librt/clock_nanosleep.c
@@ -36,9 +36,9 @@  clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
   if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
     clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
 
-  if (SINGLE_THREAD_P)
+#if defined(SINGLE_THREAD_P)
     r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem);
-  else
+#else
     {
       int oldstate = LIBC_CANCEL_ASYNC ();
 
@@ -47,6 +47,7 @@  clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
 
       LIBC_CANCEL_RESET (oldstate);
     }
+#endif
 
   return (INTERNAL_SYSCALL_ERROR_P (r, err)
 	  ? INTERNAL_SYSCALL_ERRNO (r, err) : 0);