|
|
Message-ID: <20160917145708.GW1280@port70.net>
Date: Sat, 17 Sep 2016 16:57:09 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix clock_nanosleep error case
* Daniel Sabogal <dsabogalcc@...il.com> [2016-09-17 10:36:43 -0400]:
> 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.
> ---
> src/time/clock_nanosleep.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c
> index ec87b9e..ea510a6 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)
> {
> + if (clk == CLOCK_THREAD_CPUTIME_ID) return EINVAL;
> return -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem);
you elide a cancellation point here.
i think you should check and remap the return value instead.
> }
> --
> 2.10.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.