From: Gurusamy Sarathy Date: Sat, 18 Jul 1998 02:16:40 +0000 (+0000) Subject: check ferror() only if read() returned 0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5c7a8c7888175e16e13670318410610dcb21c26f;p=p5sagit%2Fp5-mst-13.2.git check ferror() only if read() returned 0 p4raw-id: //depot/perl@1527 --- diff --git a/pp_sys.c b/pp_sys.c index fe75220..f880719 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1329,7 +1329,7 @@ PP(pp_sysread) { length = PerlIO_read(IoIFP(io), buffer+offset, length); /* fread() returns 0 on both error and EOF */ - if (PerlIO_error(IoIFP(io))) + if (length == 0 && PerlIO_error(IoIFP(io))) length = -1; } if (length < 0)