summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-08-05 18:40:44 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-05 18:40:44 +0000
commit9c0fcd4fd41b57e0b52865323ecb096f33afcdaf (patch)
treefb9cc4c27f5ad7eb7b9c4802a005c0395797473a /util.c
parentbc37a18f04c6e2feea5bb9e2e546e59c37c7c04a (diff)
downloadperl-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.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/util.c b/util.c
index 69dea5c32b..6eda3fe060 100644
--- a/util.c
+++ b/util.c
@@ -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",