diff options
author | Roland McGrath <roland@hack.frob.com> | 2015-05-26 16:11:46 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2015-05-26 16:11:46 -0700 |
commit | 4da82229f0ea9dd50e43f15705ee92d5d30c4158 (patch) | |
tree | 528135e6a18afe3095ddf155bdb624bc2103f871 | |
parent | 1f3a37b19ccc481197ffd6a5cf014dfb07c6dd4e (diff) | |
download | glibc-4da82229f0ea9dd50e43f15705ee92d5d30c4158.tar.gz glibc-4da82229f0ea9dd50e43f15705ee92d5d30c4158.tar.xz glibc-4da82229f0ea9dd50e43f15705ee92d5d30c4158.zip |
NaCl: Fix thinko in last change.
-rw-r--r-- | sysdeps/nacl/lll_timedlock_wait.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sysdeps/nacl/lll_timedlock_wait.c b/sysdeps/nacl/lll_timedlock_wait.c index df951ee8cb..1a41a6f6b4 100644 --- a/sysdeps/nacl/lll_timedlock_wait.c +++ b/sysdeps/nacl/lll_timedlock_wait.c @@ -36,17 +36,18 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime, int private) return EINVAL; /* Try locking. */ - int result = 0; while (atomic_exchange_acq (futex, 2) != 0) { /* If *futex == 2, wait until woken or timeout. */ - result = __nacl_irt_futex.futex_wait_abs ((volatile int *) futex, 2, - abstime); - if (__glibc_likely (result == 0) - || __glibc_likely (result == ETIMEDOUT)) - break; - assert (result == EAGAIN); + int err = __nacl_irt_futex.futex_wait_abs ((volatile int *) futex, 2, + abstime); + if (err != 0) + { + if (__glibc_likely (err == ETIMEDOUT)) + return err; + assert (err == EAGAIN); + } } - return result; + return 0; } |