summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-05 22:47:57 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-05 22:47:57 +0000
commit3b02c43c0619d70d7a120dfd99bbe8770f0ea6ca (patch)
tree2e86a0885cf6a68e235a05c278ed48ab502d78d6 /pp_sys.c
parent0ce625782f64de805c21893bca308710ed297c68 (diff)
downloadperl-3b02c43c0619d70d7a120dfd99bbe8770f0ea6ca.tar.gz
make read() return undef on errors as documented, and clarify docs
p4raw-id: //depot/perl@1328
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 44e520be20..a7e8dd5b3b 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1324,7 +1324,12 @@ PP(pp_sysread)
}
else
#endif
+ {
length = PerlIO_read(IoIFP(io), buffer+offset, length);
+ /* fread() returns 0 on both error and EOF */
+ if (PerlIO_error(IoIFP(io)))
+ length = -1;
+ }
if (length < 0)
goto say_undef;
SvCUR_set(bufsv, length+offset);