summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-21 04:28:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-21 04:28:08 +0000
commit69282e910994b718c7eedc8f550888058a4e93ff (patch)
tree7b03bc1b24a50d77983c616709e61e9238cee94a /pp_hot.c
parent2decb4fb82e001e3c9671c57b61232c651a9c22c (diff)
downloadperl-69282e910994b718c7eedc8f550888058a4e93ff.tar.gz
patch to report warnings on bogus filehandles passed to flock(),
more consistent warnings, from Greg Bacon <gbacon@itsc.uah.edu> (slightly modified) p4raw-id: //depot/perl@4830
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 1e669c8058..cd7b6e0eb1 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -365,15 +365,15 @@ PP(pp_print)
}
else if (!(fp = IoOFP(io))) {
if (ckWARN2(WARN_CLOSED, WARN_IO)) {
- SV* sv = sv_newmortal();
- gv_efullname3(sv, gv, Nullch);
- if (IoIFP(io))
+ if (IoIFP(io)) {
+ SV* sv = sv_newmortal();
+ gv_efullname3(sv, gv, Nullch);
Perl_warner(aTHX_ WARN_IO,
"Filehandle %s opened only for input",
SvPV(sv,n_a));
+ }
else if (ckWARN(WARN_CLOSED))
- Perl_warner(aTHX_ WARN_CLOSED,
- "print() on closed filehandle %s", SvPV(sv,n_a));
+ report_closed_fh(gv, io, "print", "filehandle");
}
SETERRNO(EBADF,IoIFP(io)?RMS$_FAC:RMS$_IFI);
goto just_say_no;
@@ -1256,13 +1256,8 @@ Perl_do_readline(pTHX)
Perl_warner(aTHX_ WARN_CLOSED,
"glob failed (can't start child: %s)",
Strerror(errno));
- else {
- SV* sv = sv_newmortal();
- gv_efullname3(sv, PL_last_in_gv, Nullch);
- Perl_warner(aTHX_ WARN_CLOSED,
- "readline() on closed filehandle %s",
- SvPV_nolen(sv));
- }
+ else
+ report_closed_fh(PL_last_in_gv, io, "readline", "filehandle");
}
if (gimme == G_SCALAR) {
(void)SvOK_off(TARG);