diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-05 18:40:44 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-05 18:40:44 +0000 |
commit | 9c0fcd4fd41b57e0b52865323ecb096f33afcdaf (patch) | |
tree | fb9cc4c27f5ad7eb7b9c4802a005c0395797473a /util.c | |
parent | bc37a18f04c6e2feea5bb9e2e546e59c37c7c04a (diff) | |
download | perl-9c0fcd4fd41b57e0b52865323ecb096f33afcdaf.tar.gz |
Essential prototype changes were missing from #6527.
Also make report_evil_fh() more bomb-proof.
p4raw-id: //depot/perl@6528
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -3890,34 +3890,41 @@ Perl_my_atof(pTHX_ const char* s) void Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op) { - bool closed = io && IoTYPE(io) == ' '; - char *vile = closed ? "closed" : "unopened"; - I32 warn = closed ? WARN_CLOSED : WARN_UNOPENED; + char *vile; + I32 warn; char *func = op == OP_READLINE ? "readline" : op == OP_LEAVEWRITE ? "write" : PL_op_desc[op]; char *pars = OP_IS_FILETEST(op) ? "" : "()"; char *type = OP_IS_SOCKET(op) ? "socket" : "filehandle"; + char *name = NULL; if (isGV(gv)) { SV *sv = sv_newmortal(); - char *name; gv_efullname4(sv, gv, Nullch, FALSE); name = SvPVX(sv); + } - Perl_warner(aTHX_ warn, "%s%s on %s %s %s", - func, pars, vile, type, name); + if (io && IoTYPE(io) == ' ') { + vile = "closed"; + warn = WARN_CLOSED; + } else { + vile = "unopened"; + warn = WARN_UNOPENED; + } + if (name) { + Perl_warner(aTHX_ warn, + "%s%s on %s %s %s", func, pars, vile, type, name); if (io && IoDIRP(io)) Perl_warner(aTHX_ warn, "\t(Are you trying to call %s%s on dirhandle %s?)\n", func, pars, name); } else { - Perl_warner(aTHX_ warn, "%s%s on %s %s", - func, pars, vile, type); - + Perl_warner(aTHX_ warn, + "%s%s on %s %s", func, pars, vile, type); if (io && IoDIRP(io)) Perl_warner(aTHX_ warn, "\t(Are you trying to call %s%s on dirhandle?)\n", |