summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-28 08:32:44 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-28 08:32:44 +0000
commit46d2cc544f36e7450798245748cda64959a6b884 (patch)
treefa8c7facf74df2ddb3cf0bba4d6d7b45130406fa /pp_sys.c
parent87563727c783b3ada5e8ad351d78411fa539328e (diff)
downloadperl-46d2cc544f36e7450798245748cda64959a6b884.tar.gz
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.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/pp_sys.c b/pp_sys.c
index b2076ccc93..0d382edac7 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;