summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-07-31 05:18:25 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-07-31 05:18:25 +0000
commitfd4a9244692671cae496a45f84ec57d6bf0ca282 (patch)
treebf6de04b92a12f618a9a301377c6774328466dd9 /regress
parentde4ac4885200b1ded7c9f62bb57c468e26c3876d (diff)
Test that longjmp from signals works. (it does)
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libc/setjmp-signal/Makefile5
-rw-r--r--regress/lib/libc/setjmp-signal/setjmp-signal.c26
2 files changed, 31 insertions, 0 deletions
diff --git a/regress/lib/libc/setjmp-signal/Makefile b/regress/lib/libc/setjmp-signal/Makefile
new file mode 100644
index 00000000000..a9649a8abe3
--- /dev/null
+++ b/regress/lib/libc/setjmp-signal/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2002/07/31 05:18:24 art Exp $
+
+PROG= setjmp-signal
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libc/setjmp-signal/setjmp-signal.c b/regress/lib/libc/setjmp-signal/setjmp-signal.c
new file mode 100644
index 00000000000..c44f657cdaa
--- /dev/null
+++ b/regress/lib/libc/setjmp-signal/setjmp-signal.c
@@ -0,0 +1,26 @@
+/* $OpenBSD: setjmp-signal.c,v 1.1 2002/07/31 05:18:24 art Exp $ */
+/*
+ * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain.
+ */
+
+#include <setjmp.h>
+#include <signal.h>
+
+jmp_buf jb;
+
+void
+segv_handler(int signum)
+{
+ longjmp(jb, 1);
+}
+
+int
+main()
+{
+ signal(SIGSEGV, segv_handler);
+ if (setjmp(jb) == 0) {
+ *((int *)0) = 0;
+ return (1);
+ }
+ return (0);
+}