Cope with wait4 being interrupted by a signal.

This commit is contained in:
Alexandre Julliard 2003-08-21 21:35:15 +00:00
parent aee989a7ed
commit de1990f4cf
1 changed files with 4 additions and 2 deletions

View File

@ -139,10 +139,11 @@ static int wait4_thread( struct thread *thread, int signal )
{ {
int res, status; int res, status;
do for (;;)
{ {
if ((res = wait4_wrapper( get_ptrace_pid(thread), &status, WUNTRACED, NULL )) == -1) if ((res = wait4_wrapper( get_ptrace_pid(thread), &status, WUNTRACED, NULL )) == -1)
{ {
if (errno == EINTR) continue;
if (errno == ECHILD) /* must have died */ if (errno == ECHILD) /* must have died */
{ {
thread->unix_pid = -1; thread->unix_pid = -1;
@ -153,7 +154,8 @@ static int wait4_thread( struct thread *thread, int signal )
return 0; return 0;
} }
res = handle_child_status( thread, res, status, signal ); res = handle_child_status( thread, res, status, signal );
} while (res && res != signal); if (!res || res == signal) break;
}
return (thread->unix_pid != -1); return (thread->unix_pid != -1);
} }