about summary refs log tree commit diff
path: root/src/signal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-10 10:17:29 -0500
committerRich Felker <dalias@aerifal.cx>2011-03-10 10:17:29 -0500
commit6871fd773dcedbf056317d5d5e87b4859e97c4a4 (patch)
tree94431cd8088870491de1d5e82a380aca96c28920 /src/signal
parent1b538acb0ac8520a8a5fd828add2e52e1d2a41eb (diff)
downloadmusl-6871fd773dcedbf056317d5d5e87b4859e97c4a4.tar.gz
musl-6871fd773dcedbf056317d5d5e87b4859e97c4a4.tar.xz
musl-6871fd773dcedbf056317d5d5e87b4859e97c4a4.zip
make sigaltstack work (missing macros in signal.h, error conditions)
Diffstat (limited to 'src/signal')
-rw-r--r--src/signal/sigaltstack.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/signal/sigaltstack.c b/src/signal/sigaltstack.c
index 3cc2d456..6e46d098 100644
--- a/src/signal/sigaltstack.c
+++ b/src/signal/sigaltstack.c
@@ -1,8 +1,18 @@
 #include <signal.h>
+#include <errno.h>
 #include "syscall.h"
 
 int sigaltstack(const stack_t *ss, stack_t *old)
 {
-	/* depends on kernel struct matching */
+	if (ss) {
+		if (ss->ss_size < MINSIGSTKSZ) {
+			errno = ENOMEM;
+			return -1;
+		}
+		if (ss->ss_flags & ~SS_DISABLE) {
+			errno = EINVAL;
+			return -1;
+		}
+	}
 	return syscall2(__NR_sigaltstack, (long)ss, (long)old);
 }