summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_sys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index fe75220d38..f8807197a7 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)