NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/51807: [PATCH] tests/lib/libc/gen/t_assert: disable core file generation in :assert_false,:assert_true
The following reply was made to PR bin/51807; it has been noted by GNATS.
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/51807: [PATCH] tests/lib/libc/gen/t_assert: disable core file
generation in :assert_false,:assert_true
Date: Tue, 10 Jan 2017 01:10:45 -0800
--Apple-Mail=_D6C5AA5F-EFC8-4714-99A6-3728325141D1
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
--Apple-Mail=_D6C5AA5F-EFC8-4714-99A6-3728325141D1
Content-Disposition: attachment;
filename=t_assert-disable-corefile-generation.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="t_assert-disable-corefile-generation.patch"
Content-Transfer-Encoding: 7bit
Index: t_assert.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/gen/t_assert.c,v
retrieving revision 1.2
diff -p -u -r1.2 t_assert.c
--- t_assert.c 14 Jun 2011 05:28:00 -0000 1.2
+++ t_assert.c 10 Jan 2017 09:02:34 -0000
@@ -31,6 +31,9 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho 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));
--Apple-Mail=_D6C5AA5F-EFC8-4714-99A6-3728325141D1--
Home |
Main Index |
Thread Index |
Old Index