From 92c6079fadf96e1babcde0781194afc3f678ff01 Mon Sep 17 00:00:00 2001 From: otto Date: Wed, 27 Sep 2023 17:06:42 +0000 Subject: [PATCH] We're not interested in the core dump, so prevent it. Also catch SIGABRT, to avoid the "Abort trap" message, which confuses me sometimes until I realize it's the purpose of this test to abort. --- .../malloc_threaderr/malloc_threaderr.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c b/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c index f34f37fc938..3c38604ede5 100644 --- a/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c +++ b/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c @@ -15,9 +15,12 @@ */ #include +#include +#include #include #include -#include +#include +#include pthread_cond_t cond; pthread_mutex_t mutex; @@ -39,12 +42,23 @@ void *f(void *arg) return NULL; } +void +catch(int x) +{ + _exit(0); +} + int main(void) { + const struct rlimit lim = {0, 0}; pthread_t t1, t2; - printf("This test is supposed to print a malloc error and create a core dump\n"); + /* prevent coredumps */ + setrlimit(RLIMIT_CORE, &lim); + printf("This test is supposed to print a malloc error\n"); + + signal(SIGABRT, catch); if (pthread_create(&t1, NULL, m, NULL)) err(1, "pthread_create"); @@ -54,5 +68,5 @@ main(void) err(1, "pthread_create"); pthread_join(t2, NULL); - return 0; + return 1; } -- 2.20.1