summaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorDaniel Sabogal <dsabogalcc@gmail.com>2016-09-17 12:05:45 -0400
committerRich Felker <dalias@aerifal.cx>2016-10-20 01:36:08 -0400
commit3ca2d2d4aef910663785fe232d7d2127a22d8a84 (patch)
tree30d39c8da7287e3f92e61cc7b6d4a8c3c0683d5d /src/time
parent688d3da0f1730daddbc954bbc2d27cc96ceee04c (diff)
downloadmusl-3ca2d2d4aef910663785fe232d7d2127a22d8a84.tar.gz
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.
Diffstat (limited to 'src/time')
-rw-r--r--src/time/clock_nanosleep.c4
1 files changed, 3 insertions, 1 deletions
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 <time.h>
+#include <errno.h>
#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;
}