summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-12-23 20:37:18 -0800
committerFather Chrysostomos <sprout@cpan.org>2013-12-23 20:37:18 -0800
commit49561e08a01a67f5fd863f1978b62a9b241d66b6 (patch)
tree724418cf4c67f02f45896554cc2053d821aaa103 /pp_sys.c
parent36b1c95c174efe412ba8229cef144b7351e5af27 (diff)
downloadperl-49561e08a01a67f5fd863f1978b62a9b241d66b6.tar.gz
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.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/pp_sys.c b/pp_sys.c
index aba3b14ee4..49122e6db1 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;