From de1990f4cf49a783e3e27a7bbf01709e9ca4aafc Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 21 Aug 2003 21:35:15 +0000 Subject: [PATCH] Cope with wait4 being interrupted by a signal. --- server/ptrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/ptrace.c b/server/ptrace.c index bffe2e4c490..42a0d3a7b36 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -139,10 +139,11 @@ static int wait4_thread( struct thread *thread, int signal ) { int res, status; - do + for (;;) { if ((res = wait4_wrapper( get_ptrace_pid(thread), &status, WUNTRACED, NULL )) == -1) { + if (errno == EINTR) continue; if (errno == ECHILD) /* must have died */ { thread->unix_pid = -1; @@ -153,7 +154,8 @@ static int wait4_thread( struct thread *thread, int signal ) return 0; } res = handle_child_status( thread, res, status, signal ); - } while (res && res != signal); + if (!res || res == signal) break; + } return (thread->unix_pid != -1); }