[testsuite] asan/clone-test-1.c: Handle clone() failure
authorChristophe Lyon <christophe.lyon@linaro.org>
Mon, 4 Jul 2016 16:19:03 +0000 (16:19 +0000)
committerChristophe Lyon <clyon@gcc.gnu.org>
Mon, 4 Jul 2016 16:19:03 +0000 (18:19 +0200)
2016-07-04  Christophe Lyon  <christophe.lyon@linaro.org>

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

From-SVN: r237987

gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/asan/clone-test-1.c

index 59a437c0421afa87fb8a0f9bc41c51c77c5204b8..9066d0f3afe085aa3dbb79bd43d338935fa05dbf 100644 (file)
@@ -1,3 +1,7 @@
+2016-07-04  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       * c-c++-common/asan/clone-test-1.c (main): Handle clone() failure.
+
 2016-07-04  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        * gcc.target/s390/vector/vec-scalar-cmp-1.c: Expect lochi instead of
index eeca09f3e689009543faa5f206f433c1c79fc6a2..c58c376f5dfe43cd1acdd166c86c4e8570b91628 100644 (file)
@@ -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) {