From: Daniel Sabogal Date: Sat, 17 Sep 2016 16:05:45 +0000 (-0400) Subject: fix clock_nanosleep error case X-Git-Tag: v1.1.16~49 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3ca2d2d4aef910663785fe232d7d2127a22d8a84;p=oweals%2Fmusl.git fix clock_nanosleep error case posix requires that EINVAL be returned if the first parameter specifies the cpu-time clock of the calling thread (CLOCK_THREAD_CPUTIME_ID). linux returns ENOTSUP instead so we handle this. --- diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c index ec87b9e3..9e4d9f1f 100644 --- a/src/time/clock_nanosleep.c +++ b/src/time/clock_nanosleep.c @@ -1,8 +1,10 @@ #include +#include #include "syscall.h" #include "libc.h" int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem) { - return -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); + int r = -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); + return clk == CLOCK_THREAD_CPUTIME_ID ? EINVAL : r; }