summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-04-24 03:32:35 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-24 03:32:35 +0000
commit218659229ea7e7f2d98c1a7697e6218c585dfb37 (patch)
tree651dd10f73daf089840a5de63e1c30c6d0ee92bf
parent82cf049f3f1023d3b5aaa03aa981bafc5f0163c8 (diff)
downloadperl-218659229ea7e7f2d98c1a7697e6218c585dfb37.tar.gz
Fix for 20010219.013, "perlio perl -we tell goes SEGV".
p4raw-id: //depot/perl@9810
-rw-r--r--util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/util.c b/util.c
index 99470a74a1..b3f1ea1eb7 100644
--- a/util.c
+++ b/util.c
@@ -4040,11 +4040,12 @@ Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
op == OP_LEAVEWRITE ? "write" : /* "write exit" not nice */
PL_op_desc[op];
char *pars = OP_IS_FILETEST(op) ? "" : "()";
- char *type = OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET) ?
+ char *type = OP_IS_SOCKET(op) ||
+ (gv && io && IoTYPE(io) == IoTYPE_SOCKET) ?
"socket" : "filehandle";
char *name = NULL;
- if (io && IoTYPE(io) == IoTYPE_CLOSED) {
+ if (gv && io && IoTYPE(io) == IoTYPE_CLOSED) {
vile = "closed";
warn_type = WARN_CLOSED;
}
@@ -4078,7 +4079,7 @@ Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
else {
Perl_warner(aTHX_ warn_type,
"%s%s on %s %s", func, pars, vile, type);
- if (io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
+ if (gv && io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
Perl_warner(aTHX_ warn_type,
"\t(Are you trying to call %s%s on dirhandle?)\n",
func, pars);