summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/setjmp
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libc/setjmp')
-rw-r--r--src/regress/lib/libc/setjmp/Makefile11
-rw-r--r--src/regress/lib/libc/setjmp/jmptest.c22
2 files changed, 14 insertions, 19 deletions
diff --git a/src/regress/lib/libc/setjmp/Makefile b/src/regress/lib/libc/setjmp/Makefile
index 25bf99d4cb..fc68e8d44c 100644
--- a/src/regress/lib/libc/setjmp/Makefile
+++ b/src/regress/lib/libc/setjmp/Makefile
@@ -1,16 +1,9 @@
1# $OpenBSD: Makefile,v 1.3 2002/01/01 23:00:51 art Exp $
1# $NetBSD: Makefile,v 1.2 1995/04/20 22:40:13 cgd Exp $ 2# $NetBSD: Makefile,v 1.2 1995/04/20 22:40:13 cgd Exp $
2 3
3PROG= setjmptest 4PROG= setjmptest
4SRCS= jmptest.c 5SRCS= jmptest.c
5NOMAN= noman, no way, man
6 6
7CFLAGS+= -DTEST_SETJMP 7CFLAGS+= -DTEST_SETJMP
8 8
9.PATH: ${.CURDIR}/../setjmp 9.include <bsd.regress.mk>
10
11install:
12
13regress: ${PROG}
14 ./${PROG}
15
16.include <bsd.prog.mk>
diff --git a/src/regress/lib/libc/setjmp/jmptest.c b/src/regress/lib/libc/setjmp/jmptest.c
index f2cecc9178..9512c9ee34 100644
--- a/src/regress/lib/libc/setjmp/jmptest.c
+++ b/src/regress/lib/libc/setjmp/jmptest.c
@@ -1,3 +1,4 @@
1/* $OpenBSD: jmptest.c,v 1.7 2003/09/02 23:52:16 david Exp $ */
1/* $NetBSD: jmptest.c,v 1.2 1995/01/01 20:55:35 jtc Exp $ */ 2/* $NetBSD: jmptest.c,v 1.2 1995/01/01 20:55:35 jtc Exp $ */
2 3
3/* 4/*
@@ -32,10 +33,12 @@
32 */ 33 */
33 34
34#include <sys/types.h> 35#include <sys/types.h>
36#include <err.h>
35#include <setjmp.h> 37#include <setjmp.h>
36#include <signal.h> 38#include <signal.h>
37#include <stdio.h> 39#include <stdio.h>
38#include <stdlib.h> 40#include <stdlib.h>
41#include <string.h>
39#include <unistd.h> 42#include <unistd.h>
40 43
41#if (TEST_SETJMP + TEST_U_SETJMP + TEST_SIGSETJMP) != 1 44#if (TEST_SETJMP + TEST_U_SETJMP + TEST_SIGSETJMP) != 1
@@ -62,21 +65,20 @@
62 65
63int expectsignal; 66int expectsignal;
64 67
65void 68static void
66aborthandler(signo) 69aborthandler(int signo)
67 int signo;
68{ 70{
69 71
70 if (expectsignal) 72 if (expectsignal)
71 exit(0); 73 _exit(0);
72 else 74 else {
73 errx(1, "kill(SIGABRT) succeeded"); 75 warnx("kill(SIGABRT) succeeded");
76 _exit(1);
77 }
74} 78}
75 79
76int 80int
77main(argc, argv) 81main(int argc, char *argv[])
78 int argc;
79 char *argv[];
80{ 82{
81 struct sigaction sa; 83 struct sigaction sa;
82 BUF jb; 84 BUF jb;
@@ -101,7 +103,7 @@ main(argc, argv)
101#endif 103#endif
102 104
103 sa.sa_handler = aborthandler; 105 sa.sa_handler = aborthandler;
104 sa.sa_mask = 0; 106 sigemptyset(&sa.sa_mask);
105 sa.sa_flags = 0; 107 sa.sa_flags = 0;
106 if (sigaction(SIGABRT, &sa, NULL) == -1) 108 if (sigaction(SIGABRT, &sa, NULL) == -1)
107 err(1, "sigaction failed"); 109 err(1, "sigaction failed");