PR remote/19496, interrupted syscall in forking-threads-plus-bkpt
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / forking-threads-plus-breakpoint.c
index fc64d93cc01018988b3c1633a4021a8ada6b2a44..c169e18d0b8b6df56180be08fb97be5f460c2dba 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <stdlib.h>
+#include <errno.h>
 
 /* Number of threads.  Each thread continuously spawns a fork and wait
    for it.  If we have another thread continuously start a step over,
@@ -49,14 +50,23 @@ thread_forks (void *arg)
     {
       pid_t pid;
 
-      pid = fork ();
+      do
+       {
+         pid = fork ();
+       }
+      while (pid == -1 && errno == EINTR);
 
       if (pid > 0)
        {
          int status;
 
          /* Parent.  */
-         pid = waitpid (pid, &status, 0);
+         do
+           {
+             pid = waitpid (pid, &status, 0);
+           }
+         while (pid == -1 && errno == EINTR);
+
          if (pid == -1)
            {
              perror ("wait");
This page took 0.024703 seconds and 4 git commands to generate.