Update Changes.
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index 2e923c5..16f3e02 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1896,7 +1896,12 @@ Perl_vwarner(pTHX_ U32  err, const char* pat, va_list* args)
            PerlIO *serr = Perl_error_log;
            PerlIO_write(serr, message, msglen);
 #ifdef LEAKTEST
-           DEBUG_L(xstat());
+           DEBUG_L(*message == '!' 
+               ? (xstat(message[1]=='!'
+                        ? (message[2]=='!' ? 2 : 1)
+                        : 0)
+                  , 0)
+               : 0);
 #endif
            (void)PerlIO_flush(serr);
        }
@@ -2676,6 +2681,7 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags)
 
     if (!pid)
        return -1;
+#if !defined(HAS_WAITPID) && !defined(HAS_WAIT4) || defined(HAS_WAITPID_RUNTIME)
     if (pid > 0) {
        sprintf(spid, "%"IVdf, (IV)pid);
        svp = hv_fetch(PL_pidstatus,spid,strlen(spid),FALSE);
@@ -2698,6 +2704,7 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags)
            return pid;
        }
     }
+#endif
 #ifdef HAS_WAITPID
 #  ifdef HAS_WAITPID_RUNTIME
     if (!HAS_WAITPID_RUNTIME)
@@ -3891,44 +3898,44 @@ void
 Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
 {
     char *vile;
-    I32   warn;
+    I32   warn_type;
     char *func =
-       op == OP_READLINE   ? "readline"  :
-       op == OP_LEAVEWRITE ? "write" :
+       op == OP_READLINE   ? "readline"  :     /* "<HANDLE>" not nice */
+       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) == 's') ?
+    char *type = OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET) ?
                      "socket" : "filehandle";
     char *name = NULL;
 
-    if (isGV(gv)) {
-       SV *sv = sv_newmortal();
-       gv_efullname4(sv, gv, Nullch, FALSE);
-       name = SvPVX(sv);
-    }
-
-    if (io && IoTYPE(io) == ' ') {
+    if (io && IoTYPE(io) == IoTYPE_CLOSED) {
        vile = "closed";
-       warn = WARN_CLOSED;
+       warn_type = WARN_CLOSED;
     }
     else {
        vile = "unopened";
-       warn = WARN_UNOPENED;
+       warn_type = WARN_UNOPENED;
+    }
+
+    if (gv && isGV(gv)) {
+       SV *sv = sv_newmortal();
+       gv_efullname4(sv, gv, Nullch, FALSE);
+       name = SvPVX(sv);
     }
 
     if (name && *name) {
-       Perl_warner(aTHX_ warn,
+       Perl_warner(aTHX_ warn_type,
                    "%s%s on %s %s %s", func, pars, vile, type, name);
-       if (io && IoDIRP(io))
-           Perl_warner(aTHX_ warn,
+       if (io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
+           Perl_warner(aTHX_ warn_type,
                        "\t(Are you trying to call %s%s on dirhandle %s?)\n",
                        func, pars, name);
     }
     else {
-       Perl_warner(aTHX_ warn,
+       Perl_warner(aTHX_ warn_type,
                    "%s%s on %s %s", func, pars, vile, type);
-       if (io && IoDIRP(io))
-           Perl_warner(aTHX_ warn,
+       if (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);
     }