summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorotto <>2023-09-27 17:06:42 +0000
committerotto <>2023-09-27 17:06:42 +0000
commit87d2a45c214d7888422f1cd6bbda1ef7f35f2c52 (patch)
treeca8c6089838e1a3e2f0b3cfea5042c5bb581f2f8 /src
parent88b042abdd67bf11258f99d6edfcb9a876738804 (diff)
downloadopenbsd-87d2a45c214d7888422f1cd6bbda1ef7f35f2c52.tar.gz
openbsd-87d2a45c214d7888422f1cd6bbda1ef7f35f2c52.tar.bz2
openbsd-87d2a45c214d7888422f1cd6bbda1ef7f35f2c52.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c b/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
index f34f37fc93..3c38604ede 100644
--- a/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
+++ b/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
@@ -15,9 +15,12 @@
15 */ 15 */
16 16
17#include <err.h> 17#include <err.h>
18#include <pthread.h>
19#include <signal.h>
18#include <stdio.h> 20#include <stdio.h>
19#include <stdlib.h> 21#include <stdlib.h>
20#include <pthread.h> 22#include <unistd.h>
23#include <sys/resource.h>
21 24
22pthread_cond_t cond; 25pthread_cond_t cond;
23pthread_mutex_t mutex; 26pthread_mutex_t mutex;
@@ -39,12 +42,23 @@ void *f(void *arg)
39 return NULL; 42 return NULL;
40} 43}
41 44
45void
46catch(int x)
47{
48 _exit(0);
49}
50
42int 51int
43main(void) 52main(void)
44{ 53{
54 const struct rlimit lim = {0, 0};
45 pthread_t t1, t2; 55 pthread_t t1, t2;
46 56
47 printf("This test is supposed to print a malloc error and create a core dump\n"); 57 /* prevent coredumps */
58 setrlimit(RLIMIT_CORE, &lim);
59 printf("This test is supposed to print a malloc error\n");
60
61 signal(SIGABRT, catch);
48 62
49 if (pthread_create(&t1, NULL, m, NULL)) 63 if (pthread_create(&t1, NULL, m, NULL))
50 err(1, "pthread_create"); 64 err(1, "pthread_create");
@@ -54,5 +68,5 @@ main(void)
54 err(1, "pthread_create"); 68 err(1, "pthread_create");
55 pthread_join(t2, NULL); 69 pthread_join(t2, NULL);
56 70
57 return 0; 71 return 1;
58} 72}