summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/sys/t_gettimeofday.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libc/sys/t_gettimeofday.c')
-rw-r--r--src/regress/lib/libc/sys/t_gettimeofday.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/regress/lib/libc/sys/t_gettimeofday.c b/src/regress/lib/libc/sys/t_gettimeofday.c
index ec4a72c63e..bb716ffdcc 100644
--- a/src/regress/lib/libc/sys/t_gettimeofday.c
+++ b/src/regress/lib/libc/sys/t_gettimeofday.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_gettimeofday.c,v 1.2 2020/10/21 16:26:28 kettenis Exp $ */ 1/* $OpenBSD: t_gettimeofday.c,v 1.3 2020/11/09 23:18:51 bluhm Exp $ */
2/* $NetBSD: t_gettimeofday.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ 2/* $NetBSD: t_gettimeofday.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
3 3
4/*- 4/*-
@@ -41,6 +41,7 @@ __RCSID("$NetBSD: t_gettimeofday.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
41#include <errno.h> 41#include <errno.h>
42#include <string.h> 42#include <string.h>
43 43
44#ifdef __OpenBSD__
44static void sighandler(int); 45static void sighandler(int);
45 46
46static void 47static void
@@ -48,6 +49,7 @@ sighandler(int signo)
48{ 49{
49 _exit(0); 50 _exit(0);
50} 51}
52#endif
51 53
52ATF_TC(gettimeofday_err); 54ATF_TC(gettimeofday_err);
53ATF_TC_HEAD(gettimeofday_err, tc) 55ATF_TC_HEAD(gettimeofday_err, tc)
@@ -58,14 +60,16 @@ ATF_TC_HEAD(gettimeofday_err, tc)
58ATF_TC_BODY(gettimeofday_err, tc) 60ATF_TC_BODY(gettimeofday_err, tc)
59{ 61{
60 62
63#ifdef __OpenBSD__
61 /* 64 /*
62 * With userland timecounters we will generate SIGSEGV instead 65 * With userland timecounters we will generate SIGSEGV instead
63 * of failing with errno so to EFAULT. POSIX explicitly 66 * of failing with errno set to EFAULT. POSIX explicitly
64 * allows this behaviour. 67 * allows this behaviour.
65 */ 68 */
66 ATF_REQUIRE(signal(SIGSEGV, sighandler) != SIG_ERR); 69 ATF_REQUIRE(signal(SIGSEGV, sighandler) != SIG_ERR);
67 70#endif
68 errno = 0; 71 errno = 0;
72
69 ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0); 73 ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0);
70} 74}
71 75