From 79cb121ab13273d637bb9dcd006259247570c62f Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Fri, 4 Jan 2002 13:02:58 +0000 Subject: test for what longjmp(.., 0) does --- regress/lib/libc/longjmp/Makefile | 3 +++ regress/lib/libc/longjmp/longjmp.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 regress/lib/libc/longjmp/Makefile create mode 100644 regress/lib/libc/longjmp/longjmp.c (limited to 'regress/lib') diff --git a/regress/lib/libc/longjmp/Makefile b/regress/lib/libc/longjmp/Makefile new file mode 100644 index 00000000000..1444cd43746 --- /dev/null +++ b/regress/lib/libc/longjmp/Makefile @@ -0,0 +1,3 @@ +PROG= longjmp + +.include diff --git a/regress/lib/libc/longjmp/longjmp.c b/regress/lib/libc/longjmp/longjmp.c new file mode 100644 index 00000000000..d8b9fe86bd6 --- /dev/null +++ b/regress/lib/libc/longjmp/longjmp.c @@ -0,0 +1,36 @@ +/* $OpenBSD: longjmp.c,v 1.1 2002/01/04 13:02:57 art Exp $ */ +/* + * Artur Grabowski Public Domain. + */ + +#include +#include +#include +#include +#include + + +jmp_buf buf; + +/* + * When longjmp is passed the incorrect arg (0), it should translate it into + * something better. + * + * Test is simple. rlimit the cpu time and throw an incorrect longjmp. If 0 + * is not translated we'll spin until we hit the cpu time limit. + */ +int +main() +{ + struct rlimit rl; + + rl.rlim_cur = 2; + rl.rlim_max = 2; + if (setrlimit(RLIMIT_CPU, &rl) < 0) + err(1, "setrlimit"); + + if (setjmp(buf) == 0) + longjmp(buf, 0); + + return 0; +} -- cgit v1.2.3