about summary refs log tree commit diff
path: root/src/signal/sigprocmask.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-09 20:31:06 -0500
committerRich Felker <dalias@aerifal.cx>2011-03-09 20:31:06 -0500
commit500c969f059dc1b12dc3809d270cb169abbd57d3 (patch)
tree451ff6c500acea4d15c1e908bb8515016b09f405 /src/signal/sigprocmask.c
parent3f5420bcda134de80ed6b0f0da1d7d23f147a4cc (diff)
downloadmusl-500c969f059dc1b12dc3809d270cb169abbd57d3.tar.gz
musl-500c969f059dc1b12dc3809d270cb169abbd57d3.tar.xz
musl-500c969f059dc1b12dc3809d270cb169abbd57d3.zip
fix error handling for pthread_sigmask
it must return errno, not -1, and should reject invalud values for how.
Diffstat (limited to 'src/signal/sigprocmask.c')
-rw-r--r--src/signal/sigprocmask.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/signal/sigprocmask.c b/src/signal/sigprocmask.c
index 1bc5baa6..96d08478 100644
--- a/src/signal/sigprocmask.c
+++ b/src/signal/sigprocmask.c
@@ -1,4 +1,5 @@
 #include <signal.h>
+#include <errno.h>
 #include "syscall.h"
 #include "libc.h"
 #include "pthread_impl.h"
@@ -11,6 +12,10 @@ int __libc_sigprocmask(int how, const sigset_t *set, sigset_t *old)
 int __sigprocmask(int how, const sigset_t *set, sigset_t *old)
 {
 	sigset_t tmp;
+	if (how > 2U) {
+		errno = EINVAL;
+		return -1;
+	}
 	/* Disallow blocking thread control signals */
 	if (set && how != SIG_UNBLOCK) {
 		tmp = *set;
@@ -22,4 +27,3 @@ int __sigprocmask(int how, const sigset_t *set, sigset_t *old)
 }
 
 weak_alias(__sigprocmask, sigprocmask);
-weak_alias(__sigprocmask, pthread_sigmask);