summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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}