summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-30 17:45:53 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-30 18:08:10 +0000
commit32b81f04b91d544d040cdd9e25388bbe78e52fb7 (patch)
tree12a4b394517db7a5169bb9e39025df9fe608b573 /pp_sys.c
parentfbcda526a9bbe2ee1302d6f4507b07f83661fc0d (diff)
downloadperl-32b81f04b91d544d040cdd9e25388bbe78e52fb7.tar.gz
Merge the opcode bodies for pp_bind and pp_connect.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/pp_sys.c b/pp_sys.c
index d93cc8712b..6a89fb4e34 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2488,42 +2488,17 @@ PP(pp_bind)
GV * const gv = MUTABLE_GV(POPs);
register IO * const io = GvIOn(gv);
STRLEN len;
+ const int op_type = PL_op->op_type;
if (!io || !IoIFP(io))
goto nuts;
addr = SvPV_const(addrsv, len);
- TAINT_PROPER("bind");
- if (PerlSock_bind(PerlIO_fileno(IoIFP(io)), (struct sockaddr *)addr, len) >= 0)
- RETPUSHYES;
- else
- RETPUSHUNDEF;
-
-nuts:
- report_evil_fh(gv);
- SETERRNO(EBADF,SS_IVCHAN);
- RETPUSHUNDEF;
-#else
- DIE(aTHX_ PL_no_sock_func, "bind");
-#endif
-}
-
-PP(pp_connect)
-{
-#ifdef HAS_SOCKET
- dVAR; dSP;
- SV * const addrsv = POPs;
- GV * const gv = MUTABLE_GV(POPs);
- register IO * const io = GvIOn(gv);
- const char *addr;
- STRLEN len;
-
- if (!io || !IoIFP(io))
- goto nuts;
-
- addr = SvPV_const(addrsv, len);
- TAINT_PROPER("connect");
- if (PerlSock_connect(PerlIO_fileno(IoIFP(io)), (struct sockaddr *)addr, len) >= 0)
+ TAINT_PROPER(PL_op_desc[op_type]);
+ if ((op_type == OP_BIND
+ ? PerlSock_bind(PerlIO_fileno(IoIFP(io)), (struct sockaddr *)addr, len)
+ : PerlSock_connect(PerlIO_fileno(IoIFP(io)), (struct sockaddr *)addr, len))
+ >= 0)
RETPUSHYES;
else
RETPUSHUNDEF;
@@ -2533,7 +2508,7 @@ nuts:
SETERRNO(EBADF,SS_IVCHAN);
RETPUSHUNDEF;
#else
- DIE(aTHX_ PL_no_sock_func, "connect");
+ DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]);
#endif
}