lib/process: handle EINTR from waitpid
authorJeremy Kerr <jk@ozlabs.org>
Tue, 20 Aug 2013 02:30:57 +0000 (10:30 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 20 Aug 2013 02:30:57 +0000 (10:30 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/process/process.c

index 6fac6492eeedd2524c71de8d4ee620a73cc3b47b..1a16fb6312b4fb74dc8cc753806009e939bd7691 100644 (file)
@@ -355,8 +355,13 @@ int process_run_sync(struct process *process)
 
        process_read_stdout(procinfo);
 
-       rc = waitpid(process->pid, &process->exit_status, 0);
-       if (rc == -1) {
+       for (;;) {
+               rc = waitpid(process->pid, &process->exit_status, 0);
+               if (rc >= 0)
+                       break;
+               if (errno == EINTR)
+                       continue;
+
                pb_log("%s: waitpid failed: %s\n", __func__, strerror(errno));
                return rc;
        }