From 46d2cc544f36e7450798245748cda64959a6b884 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 28 Dec 2010 08:32:44 +0000 Subject: [PATCH] In pp_sockpair, remove duplication of code to close the supplied file handles. It's not necessary to (also) test gv1 and gv2 before returning undef as an error, because io1 will automatically be NULL if gv1 is NULL, and similarly io2 if gv2 is. --- pp_sys.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pp_sys.c b/pp_sys.c index b2076cc..0d382ed 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2454,18 +2454,16 @@ PP(pp_sockpair) if (!gv2 || !io2) report_evil_fh(gv2, io2, PL_op->op_type); } - if (io1 && IoIFP(io1)) - do_close(gv1, FALSE); - if (io2 && IoIFP(io2)) - do_close(gv2, FALSE); - RETPUSHUNDEF; } - if (IoIFP(io1)) + if (io1 && IoIFP(io1)) do_close(gv1, FALSE); - if (IoIFP(io2)) + if (io2 && IoIFP(io2)) do_close(gv2, FALSE); + if (!io1 || !io2) + RETPUSHUNDEF; + TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF; -- 2.7.4