diff mbox

[testsuite] asan/clone-test-1.c: Handle clone() failure

Message ID CAKdteObPuyiLYoCgXU8uqE8kaaww4-Vg-JLL+vTHPcs7GMfD7Q@mail.gmail.com
State Accepted
Commit 740f9751fbd5ab7475cd358a6f60e4ab04b923cd
Headers show

Commit Message

Christophe Lyon July 4, 2016, 3:44 p.m. UTC
Hello,

This small patch handles the case were clone() would fail when
executing asan/clone-test-1.c.

OK?

Christophe
2016-07-04  Christophe Lyon  <christophe.lyon@linaro.org>

	* c-c++-common/asan/clone-test-1.c (main): Handle clone() failure.
diff mbox

Patch

diff --git a/gcc/testsuite/c-c++-common/asan/clone-test-1.c b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
index eeca09f..c58c376 100644
--- a/gcc/testsuite/c-c++-common/asan/clone-test-1.c
+++ b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
@@ -29,6 +29,10 @@  int main(int argc, char **argv) {
   char *sp = child_stack + kStackSize;  /* Stack grows down. */
   printf("Parent: %p\n", sp);
   pid_t clone_pid = clone(Child, sp, CLONE_FILES | CLONE_VM, NULL, 0, 0, 0);
+  if (clone_pid == -1) {
+    perror("clone");
+    return 1;
+  }
   int status;
   pid_t wait_result = waitpid(clone_pid, &status, __WCLONE);
   if (wait_result < 0) {