summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorSlaven Rezic <slaven@rezic.de>2002-10-24 02:44:35 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-11-06 20:43:14 +0000
commitb5fe5ca2134a9ef76f895fb7bc7abec4e8196b08 (patch)
treed5d5274d84dd6dfa2a4103e403440d05c5478c54 /pp_sys.c
parent62e36f8a468863e09ecdb7f4dfc6bb112b1a327e (diff)
downloadperl-b5fe5ca2134a9ef76f895fb7bc7abec4e8196b08.tar.gz
Re: [perl #18048] read \*FH, ... returns undef but doesn' t set $! if \*FH not open
Message-ID: <87vg3sixm4.fsf@vran.herceg.de> p4raw-id: //depot/perl@18115
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 2d27d86355..2939e90551 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -734,6 +734,7 @@ PP(pp_binmode)
if (!(io = GvIO(gv)) || !(fp = IoIFP(io))) {
if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
report_evil_fh(gv, io, PL_op->op_type);
+ SETERRNO(EBADF,RMS_IFI);
RETPUSHUNDEF;
}
@@ -1177,6 +1178,7 @@ PP(pp_getc)
if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)
&& (!io || (!IoIFP(io) && IoTYPE(io) != IoTYPE_WRONLY)))
report_evil_fh(gv, io, PL_op->op_type);
+ SETERRNO(EBADF,RMS_IFI);
RETPUSHUNDEF;
}
TAINT;
@@ -1571,8 +1573,12 @@ PP(pp_sysread)
else
offset = 0;
io = GvIO(gv);
- if (!io || !IoIFP(io))
+ if (!io || !IoIFP(io)) {
+ if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
+ report_evil_fh(gv, io, PL_op->op_type);
+ SETERRNO(EBADF,RMS_IFI);
goto say_undef;
+ }
if ((fp_utf8 = PerlIO_isutf8(IoIFP(io))) && !IN_BYTES) {
buffer = SvPVutf8_force(bufsv, blen);
/* UTF8 may not have been set if they are all low bytes */
@@ -1813,6 +1819,7 @@ PP(pp_send)
retval = -1;
if (ckWARN(WARN_CLOSED))
report_evil_fh(gv, io, PL_op->op_type);
+ SETERRNO(EBADF,RMS_IFI);
goto say_undef;
}