From: Bo Lindbergh <blgl@hagernas.com>
Date: Sat, 20 Jan 2007 02:39:57 +0000 (+0100)
Subject: Re: Race condition in IPC::Open3 / Mac OS?
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3be372353a263b94b1bb39fd4c8da0548050a63;p=p5sagit%2Fp5-mst-13.2.git

Re: Race condition in IPC::Open3 / Mac OS?
Message-Id: <D256CF03-D814-4973-9DF6-60EA4F26FE10@hagernas.com>

p4raw-id: //depot/perl@29894
---

diff --git a/perlio.c b/perlio.c
index 6e2d9e1..9396650 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3419,9 +3419,15 @@ PerlIOStdio_fill(pTHX_ PerlIO *f)
 	if (PerlSIO_fflush(stdio) != 0)
 	    return EOF;
     }
-    c = PerlSIO_fgetc(stdio);
-    if (c == EOF)
-	return EOF;
+    for (;;) {
+	c = PerlSIO_fgetc(stdio);
+	if (c != EOF)
+	    break;
+	if (! PerlSIO_ferror(stdio) || errno != EINTR)
+	    return EOF;
+	PERL_ASYNC_CHECK();
+	SETERRNO(0,0);
+    }
 
 #if (defined(STDIO_PTR_LVALUE) && (defined(STDIO_CNT_LVALUE) || defined(STDIO_PTR_LVAL_SETS_CNT)))