summaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-03-01 11:30:40 -0800
committerDavid 'Digit' Turner <digit@google.com>2010-03-01 11:30:40 -0800
commit8f8b5310d2c3fe8782377bd66b65ed14dc6511a4 (patch)
tree1cd0c6e85535467a0ffd973991aef7bccb499473 /libc/bionic/pthread.c
parent1f6f49396335d88c577c16304b1989d0d1468e5c (diff)
downloadbionic-8f8b5310d2c3fe8782377bd66b65ed14dc6511a4.zip
bionic-8f8b5310d2c3fe8782377bd66b65ed14dc6511a4.tar.gz
bionic-8f8b5310d2c3fe8782377bd66b65ed14dc6511a4.tar.bz2
Fix pthread_sigmask() to return correct error values.
Before that, it returned -1 on error and set errno (not Posix) After the patch, it returns the error code and leaves errno untouched.
Diffstat (limited to 'libc/bionic/pthread.c')
-rw-r--r--libc/bionic/pthread.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 8171aac..c1a6a8a 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -1688,7 +1688,17 @@ extern int __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
{
- return __rt_sigprocmask(how, set, oset, _NSIG / 8);
+ /* pthread_sigmask must return the error code, but the syscall
+ * will set errno instead and return 0/-1
+ */
+ int ret, old_errno = errno;
+
+ ret = __rt_sigprocmask(how, set, oset, _NSIG / 8);
+ if (ret < 0)
+ ret = errno;
+
+ errno = old_errno;
+ return ret;
}