diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-12-23 11:45:28 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-12-23 11:45:28 +0000 |
commit | cf16741603085845f81fd648e5e3d2673dbdf560 (patch) | |
tree | 79c6bd9f441f8383aa55c6ea3159c74353e1717a /pp_sys.c | |
parent | ccc668fa9b49e415d3bc71997bdc482360964ed7 (diff) | |
download | perl-cf16741603085845f81fd648e5e3d2673dbdf560.tar.gz |
syswrite() wasn't reporting a warning when writing to a filehandle
opened only for input.
p4raw-id: //depot/perl@29614
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1829,10 +1829,14 @@ PP(pp_send) SETERRNO(0,0); io = GvIO(gv); - if (!io || !IoIFP(io)) { + if (!io || !IoIFP(io) || IoTYPE(io) == IoTYPE_RDONLY) { retval = -1; - if (ckWARN(WARN_CLOSED)) - report_evil_fh(gv, io, PL_op->op_type); + if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) { + if (io && IoIFP(io)) + report_evil_fh(gv, io, OP_phoney_INPUT_ONLY); + else + report_evil_fh(gv, io, PL_op->op_type); + } SETERRNO(EBADF,RMS_IFI); goto say_undef; } |