From: Trond Norbye Date: Thu, 17 Dec 2009 09:25:19 +0000 (+0100) Subject: create_core should wait for the child to be done writing the core X-Git-Tag: 0.37~61^2~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=c47100252c635d42edd69c3a99dd63b665b01e45;p=m6w6%2Flibmemcached create_core should wait for the child to be done writing the core --- 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) + { + ; + } + } + } }