emit more appropriate diagnostic for failed glob (variant
[p5sagit/p5-mst-13.2.git] / pp_hot.c
index 5fa2bef..7709c53 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1270,9 +1270,14 @@ do_readline(void)
            SP--;
     }
     if (!fp) {
-       if (ckWARN(WARN_CLOSED) && io && !(IoFLAGS(io) & IOf_START))
-           warner(WARN_CLOSED,
-                  "Read on closed filehandle <%s>", GvENAME(PL_last_in_gv));
+       if (ckWARN(WARN_CLOSED) && io && !(IoFLAGS(io) & IOf_START)) {
+           if (type == OP_GLOB)
+               warner(WARN_CLOSED, "glob failed (can't start child: %s)",
+                      Strerror(errno));
+           else
+               warner(WARN_CLOSED, "Read on closed filehandle <%s>",
+                      GvENAME(PL_last_in_gv));
+       }
        if (gimme == G_SCALAR) {
            (void)SvOK_off(TARG);
            PUSHTARG;