From: Steve Grazzini Date: Sat, 4 Oct 2003 18:15:23 +0000 (-0400) Subject: pp_sys.c: pp_waitpid and EINTR X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ec0bfb3e2d19a14c6a2cf1939c9549394a191c1;p=p5sagit%2Fp5-mst-13.2.git pp_sys.c: pp_waitpid and EINTR Message-Id: <20031004221523.GA29324@grazzini.net> p4raw-id: //depot/perl@21402 --- diff --git a/pp_sys.c b/pp_sys.c index 8253df9..10d0529 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4037,27 +4037,28 @@ PP(pp_waitpid) { #if (!defined(DOSISH) || defined(OS2) || defined(WIN32)) && !defined(MACOS_TRADITIONAL) dSP; dTARGET; - Pid_t childpid; + Pid_t pid; + Pid_t result; int optype; int argflags; optype = POPi; - childpid = TOPi; + pid = TOPi; if (PL_signals & PERL_SIGNALS_UNSAFE_FLAG) - childpid = wait4pid(childpid, &argflags, optype); + result = wait4pid(pid, &argflags, optype); else { - while ((childpid = wait4pid(childpid, &argflags, optype)) == -1 && + while ((result = wait4pid(pid, &argflags, optype)) == -1 && errno == EINTR) { PERL_ASYNC_CHECK(); } } # if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS) /* 0 and -1 are both error returns (the former applies to WNOHANG case) */ - STATUS_NATIVE_SET((childpid && childpid != -1) ? argflags : -1); + STATUS_NATIVE_SET((result && result != -1) ? argflags : -1); # else - STATUS_NATIVE_SET((childpid > 0) ? argflags : -1); + STATUS_NATIVE_SET((result > 0) ? argflags : -1); # endif - SETi(childpid); + SETi(result); RETURN; #else DIE(aTHX_ PL_no_func, "waitpid");