PR/51807: Ngie Cooper: disable core file generation in :assert_false,
:assert_true
This commit is contained in:
parent
55dbe9a7ba
commit
473b6e44f3
|
@ -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/06/14 05:28:00 jruoho Exp $");
|
|||
#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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue