From c47100252c635d42edd69c3a99dd63b665b01e45 Mon Sep 17 00:00:00 2001 From: Trond Norbye Date: Thu, 17 Dec 2009 10:25:19 +0100 Subject: [PATCH] create_core should wait for the child to be done writing the core --- tests/test.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/test.c b/tests/test.c index f95141b1..793bcbd7 100644 --- a/tests/test.c +++ b/tests/test.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -62,8 +63,22 @@ static const char *test_strerror(test_return_t code) void create_core(void) { - if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL && fork() == 0) - abort(); + if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL) + { + pid_t pid= fork(); + + if (pid == 0) + { + abort(); + } + else + { + while (waitpid(pid, NULL, 0) != pid) + { + ; + } + } + } } -- 2.30.2