about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-08-02 21:18:43 -0400
committerRich Felker <dalias@aerifal.cx>2011-08-02 21:18:43 -0400
commit4717bfec708d264111f70f37850ffc09238c4bd5 (patch)
tree25c24672e32621ae50ac5e569031f37c4b8c7cb0
parentbdd893377fe65519fae90948cd8f3c635757eaba (diff)
downloadmusl-4717bfec708d264111f70f37850ffc09238c4bd5.tar.gz
musl-4717bfec708d264111f70f37850ffc09238c4bd5.tar.xz
musl-4717bfec708d264111f70f37850ffc09238c4bd5.zip
correctly handle old kernels without FUTEX_WAIT_BITSET
futex returns EINVAL, not ENOSYS, when op is not supported.
unfortunately this looks just like EINVAL from other causes, and we
end up running the fallback code and getting EINVAL again. fortunately
this case should be rare since correct code should not generate EINVAL
anyway.
-rw-r--r--src/thread/__timedwait.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c
index 931675eb..0444d39f 100644
--- a/src/thread/__timedwait.c
+++ b/src/thread/__timedwait.c
@@ -16,7 +16,7 @@ static int do_wait(volatile int *addr, int val, clockid_t clk, const struct time
 		if (clk == CLOCK_REALTIME) flag = FUTEX_CLOCK_REALTIME;
 		if (cp) r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT_BITSET|flag, val, at, 0, -1);
 		else r = -__syscall(SYS_futex, addr, FUTEX_WAIT_BITSET|flag, val, at, 0, -1);
-		if (r != ENOSYS) goto done;
+		if (r != EINVAL) goto done;
 	}
 	if (clock_gettime(clk, &to)) return EINVAL;
 	to.tv_sec = at->tv_sec - to.tv_sec;