summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-08 14:29:08 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-08 19:54:18 +0000
commite2712234fb9f66b89b77d929912e337172313635 (patch)
tree4e2968f62f36966780a32d38a372c8ce1545f006 /pp_sys.c
parentb5ce1198cdc91a8659e421932c6de164a98d9b39 (diff)
downloadperl-e2712234fb9f66b89b77d929912e337172313635.tar.gz
In pp_send, transpose the blocks for OP_SYSWRITE and OP_SEND
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 26129aba0a..f8370f7c76 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1894,7 +1894,23 @@ PP(pp_send)
}
}
- if (op_type == OP_SYSWRITE) {
+ if (op_type == OP_SEND) {
+#ifdef HAS_SOCKET
+ const int flags = SvIVx(*++MARK);
+ if (SP > MARK) {
+ STRLEN mlen;
+ char * const sockbuf = SvPVx(*++MARK, mlen);
+ retval = PerlSock_sendto(PerlIO_fileno(IoIFP(io)), buffer, blen,
+ flags, (struct sockaddr *)sockbuf, mlen);
+ }
+ else {
+ retval
+ = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer, blen, flags);
+ }
+#else
+ DIE(aTHX_ PL_no_sock_func, "send");
+#endif
+ } else {
Size_t length = 0; /* This length is in characters. */
STRLEN blen_chars;
IV offset;
@@ -1989,24 +2005,6 @@ PP(pp_send)
buffer, length);
}
}
-#ifdef HAS_SOCKET
- else {
- const int flags = SvIVx(*++MARK);
- if (SP > MARK) {
- STRLEN mlen;
- char * const sockbuf = SvPVx(*++MARK, mlen);
- retval = PerlSock_sendto(PerlIO_fileno(IoIFP(io)), buffer, blen,
- flags, (struct sockaddr *)sockbuf, mlen);
- }
- else {
- retval
- = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer, blen, flags);
- }
- }
-#else
- else
- DIE(aTHX_ PL_no_sock_func, "send");
-#endif
if (retval < 0)
goto say_undef;