In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/49561e08a01a67f5fd863f1978b62a9b241d66b6?hp=36b1c95c174efe412ba8229cef144b7351e5af27>
- Log ----------------------------------------------------------------- commit 49561e08a01a67f5fd863f1978b62a9b241d66b6 Author: Father Chrysostomos <[email protected]> Date: Mon Dec 23 20:37:18 2013 -0800 pp_sys.c: Remove null checks from pp_sockpair There is actually no way for nulls to reach this code. Nulls on the stack only happen with pp_coreargs, and only with ops that have optional arguments, of which socketpair is not one. GvIOn uses gv_add_by_type, which adds a new IO if there is not already one, so it will never return null if the GV is not null. ----------------------------------------------------------------------- Summary of changes: pp_sys.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/pp_sys.c b/pp_sys.c index aba3b14..49122e6 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2415,27 +2415,17 @@ PP(pp_sockpair) const int protocol = POPi; const int type = POPi; const int domain = POPi; - GV * gv1; - IO * io1; GV * const gv2 = MUTABLE_GV(POPs); - IO * const io2 = gv2 ? GvIOn(gv2) : NULL; - if (!io2) - report_evil_fh(gv2); + IO * const io2 = GvIOn(gv2); + GV * const gv1 = MUTABLE_GV(POPs); + IO * const io1 = GvIOn(gv1); - gv1 = MUTABLE_GV(POPs); - io1 = gv1 ? GvIOn(gv1) : NULL; - if (!io1) - report_evil_fh(gv1); - - if (io1 && IoIFP(io1)) + if (IoIFP(io1)) do_close(gv1, FALSE); - if (io2 && IoIFP(io2)) + if (IoIFP(io2)) do_close(gv2, FALSE); - if (!io1 || !io2) - RETPUSHUNDEF; - TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF; -- Perl5 Master Repository
