From 70d5014266ec6659e9a9a7c8f9ba320385c9caec Mon Sep 17 00:00:00 2001 From: Oguz Bastemur Date: Thu, 14 Apr 2016 14:35:23 +0200 Subject: [PATCH] android: pthread_sigmask() does not set errno Originally intended workaround is especially needed for Android <4.4. However it fails to compare errno collected from pthread_sigmask. This has been fixed separately in JXcore. See issue: https://github.com/jxcore/jxcore-cordova/issues/55 PR-URL: https://github.com/libuv/libuv/pull/833 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/unix/pthread-fixes.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/unix/pthread-fixes.c b/src/unix/pthread-fixes.c index 3a71eb5a..0c4a4751 100644 --- a/src/unix/pthread-fixes.c +++ b/src/unix/pthread-fixes.c @@ -39,19 +39,23 @@ int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset) { static int workaround; + int err; if (workaround) { return sigprocmask(how, set, oset); - } else if (pthread_sigmask(how, set, oset)) { - if (errno == EINVAL && sigprocmask(how, set, oset) == 0) { - workaround = 1; - return 0; - } else { - return -1; - } } else { - return 0; + err = pthread_sigmask(how, set, oset); + if (err) { + if (err == EINVAL && sigprocmask(how, set, oset) == 0) { + workaround = 1; + return 0; + } else { + return -1; + } + } } + + return 0; } /*Android doesn't provide pthread_barrier_t for now.*/