This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: The long awaited feature ...
authorSimon Cozens <simon@netthink.co.uk>
Sun, 17 Dec 2000 12:31:56 +0000 (12:31 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 17 Dec 2000 17:39:35 +0000 (17:39 +0000)
Message-ID: <20001217123156.A3891@deep-dark-truthful-mirror.perlhacker.org>

Add a warning to binmode() about using bad filehandles
(can happen e.g. if someone forgets the filehandle argument)

p4raw-id: //depot/perl@8145

pp_sys.c

index 7d6386e..0c834ca 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -709,8 +709,10 @@ PP(pp_binmode)
     }
 
     EXTEND(SP, 1);
-    if (!(io = GvIO(gv)) || !(fp = IoIFP(io)))
-       RETPUSHUNDEF;
+    if (!(io = GvIO(gv)) || !(fp = IoIFP(io))) {
+        report_evil_fh(gv, io, PL_op->op_type);
+        RETPUSHUNDEF;
+    }
 
     if (discp) {
        names = SvPV(discp,len);