Module Name: src Committed By: christos Date: Tue Jan 10 15:17:57 UTC 2017
Modified Files: src/tests/lib/libc/gen: t_assert.c Log Message: PR/51807: Ngie Cooper: disable core file generation in :assert_false, :assert_true To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/t_assert.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/libc/gen/t_assert.c diff -u src/tests/lib/libc/gen/t_assert.c:1.2 src/tests/lib/libc/gen/t_assert.c:1.3 --- src/tests/lib/libc/gen/t_assert.c:1.2 Tue Jun 14 01:28:00 2011 +++ src/tests/lib/libc/gen/t_assert.c Tue Jan 10 10:17:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $ */ +/* $NetBSD: t_assert.c,v 1.3 2017/01/10 15:17:57 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,8 +29,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $"); +__RCSID("$NetBSD: t_assert.c,v 1.3 2017/01/10 15:17:57 christos Exp $"); +#include <sys/types.h> +#include <sys/resource.h> +#include <sys/time.h> #include <sys/wait.h> #include <assert.h> @@ -40,6 +43,17 @@ __RCSID("$NetBSD: t_assert.c,v 1.2 2011/ #include <string.h> #include <unistd.h> +static void +disable_corefile(void) +{ + struct rlimit limits; + + limits.rlim_cur = 0; + limits.rlim_max = 0; + + ATF_REQUIRE(setrlimit(RLIMIT_CORE, &limits) == 0); +} + static void handler(int); static void @@ -65,6 +79,7 @@ ATF_TC_BODY(assert_false, tc) if (pid == 0) { + disable_corefile(); (void)closefrom(0); (void)memset(&sa, 0, sizeof(struct sigaction)); @@ -102,6 +117,7 @@ ATF_TC_BODY(assert_true, tc) if (pid == 0) { + disable_corefile(); (void)closefrom(0); (void)memset(&sa, 0, sizeof(struct sigaction));