slurping an empty file should return '' rather than undef, with
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index a35a206..e4694bc 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1003,8 +1003,13 @@ PP(pp_select)
     }
 
     if (newdefout) {
-       if (!GvIO(newdefout))
-           gv_IOadd(newdefout);
+       if (!GvIO(newdefout)) {
+           if (ckWARN(WARN_UNOPENED))
+               warner(WARN_UNOPENED, "select() on unopened file");
+           if (SvTYPE(newdefout) != SVt_PVGV)
+               RETURN;
+           gv_IOadd(newdefout);        /* XXX probably bogus */
+       }
        setdefout(newdefout);
     }