This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
check ferror() only if read() returned 0
authorGurusamy Sarathy <gsar@cpan.org>
Sat, 18 Jul 1998 02:16:40 +0000 (02:16 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 18 Jul 1998 02:16:40 +0000 (02:16 +0000)
p4raw-id: //depot/perl@1527

pp_sys.c

index fe75220..f880719 100644 (file)
--- 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 */
     {
        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)
            length = -1;
     }
     if (length < 0)