aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread_sigmask.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-02-12 16:40:24 +0000
committerElliott Hughes <enh@google.com>2013-02-12 15:27:18 -0800
commit3e898476c7230b60a0f76968e64ff25f475b48c0 (patch)
tree0f876aeb565b7e7ac627a6305a355c40173912f2 /libc/bionic/pthread_sigmask.cpp
parentfcaf4e9f9b735e053469c7ecbf63584e10fd67a7 (diff)
downloadandroid_bionic-3e898476c7230b60a0f76968e64ff25f475b48c0.tar.gz
android_bionic-3e898476c7230b60a0f76968e64ff25f475b48c0.tar.bz2
android_bionic-3e898476c7230b60a0f76968e64ff25f475b48c0.zip
Revert "Revert "More pthreads cleanup.""
This reverts commit 6f94de3ca49e4ea147b1c59e5818fa175846518f (Doesn't try to increase the number of TLS slots; that leads to an inability to boot. Adds more tests.) Change-Id: Ia7d25ba3995219ed6e686463dbba80c95cc831ca
Diffstat (limited to 'libc/bionic/pthread_sigmask.cpp')
-rw-r--r--libc/bionic/pthread_sigmask.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/libc/bionic/pthread_sigmask.cpp b/libc/bionic/pthread_sigmask.cpp
index 9c9dc3ed8..e4e1b2b98 100644
--- a/libc/bionic/pthread_sigmask.cpp
+++ b/libc/bionic/pthread_sigmask.cpp
@@ -30,12 +30,13 @@
#include <pthread.h>
#include <signal.h>
-#include <private/kernel_sigset_t.h>
+#include "private/ErrnoRestorer.h"
+#include "private/kernel_sigset_t.h"
extern "C" int __rt_sigprocmask(int, const kernel_sigset_t*, kernel_sigset_t*, size_t);
int pthread_sigmask(int how, const sigset_t* iset, sigset_t* oset) {
- int old_errno = errno;
+ ErrnoRestorer errno_restorer;
// 'in_set_ptr' is the second parameter to __rt_sigprocmask. It must be NULL
// if 'set' is NULL to ensure correct semantics (which in this case would
@@ -48,15 +49,13 @@ int pthread_sigmask(int how, const sigset_t* iset, sigset_t* oset) {
}
kernel_sigset_t out_set;
- int result = __rt_sigprocmask(how, in_set_ptr, &out_set, sizeof(out_set));
- if (result < 0) {
- result = errno;
+ if (__rt_sigprocmask(how, in_set_ptr, &out_set, sizeof(out_set)) == -1) {
+ return errno;
}
if (oset != NULL) {
*oset = out_set.bionic;
}
- errno = old_errno;
- return result;
+ return 0;
}