about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-02-27 23:25:45 -0500
committerRich Felker <dalias@aerifal.cx>2015-02-27 23:25:45 -0500
commit76ca7a5446a8aec2b671a401d5e1878c4704754e (patch)
treef28de9c011b65effa19b419bd923686a14efc500 /src
parente346ff86c8faee901a7c2d502b5beb983b99f972 (diff)
downloadmusl-76ca7a5446a8aec2b671a401d5e1878c4704754e.tar.gz
musl-76ca7a5446a8aec2b671a401d5e1878c4704754e.tar.xz
musl-76ca7a5446a8aec2b671a401d5e1878c4704754e.zip
fix failure of internal futex __timedwait to report ECANCELED
as part of abstracting the futex wait, this function suppresses all
futex error values which callers should not see using a whitelist
approach. when the masked cancellation mode was added, the new
ECANCELED error was not whitelisted. this omission caused the new
pthread_cond_wait code using masked cancellation to exhibit a spurious
wake (rather than acting on cancellation) when the request arrived
after blocking on the cond var.
Diffstat (limited to 'src')
-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 c9ec70cf..9b882b5a 100644
--- a/src/thread/__timedwait.c
+++ b/src/thread/__timedwait.c
@@ -33,7 +33,7 @@ int __timedwait(volatile int *addr, int val,
 
 	r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT|priv, val, top);
 	if (r == ENOSYS) r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT, val, top);
-	if (r != EINTR && r != ETIMEDOUT) r = 0;
+	if (r != EINTR && r != ETIMEDOUT && r != ECANCELED) r = 0;
 
 	pthread_cleanup_pop(0);
 	if (!cleanup) __pthread_setcancelstate(cs, 0);