summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorJonathan Hudson <Jonathan.Hudson@jrhudson.demon.co.uk>1997-05-22 17:56:26 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-06-11 12:00:00 +1200
commit490ab354c465618bcdee84ecc1d256c265518f0a (patch)
tree24c8a038a5c1c4c8df3c3116e1c574215c56acc4 /pp_sys.c
parent14ba8c9ed9cfdc22434f89b374aaf17cc48fd4a0 (diff)
downloadperl-490ab354c465618bcdee84ecc1d256c265518f0a.tar.gz
lib/io_udp.t fails on VMS
perl 5.004 built without error or warning on VMS AXP/DECC with DECCRTL (UCX) sockets (no sockshr library). However it fails the lib/io_udp.t test for the following reasons: 1. The 'fromlen' parameter in pp_sysread *must* be sizeof(struct sockaddr) or the DECCRTL fails with an invalid buffer size error. 2. The DECCRTL/UCX getpeerhost() function returns defined and a blank 'sockaddr' for udp hosts. A similar fix to that in vms/sockadapt.h (for sockshr) is required for DECCRTL in pp_sys.c The following diff (unix, sorry VMS folks) patches pp_sys.c so that the udp test is successful using UCX. p5p-msgid: XFMail.970522181042.Jonathan.Hudson@jrhudson.demon.co.uk
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 03a10fea73..5e1f427727 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1243,7 +1243,11 @@ PP(pp_sysread)
#ifdef HAS_SOCKET
if (op->op_type == OP_RECV) {
char namebuf[MAXPATHLEN];
+#if defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)
+ bufsize = sizeof (struct sockaddr_in);
+#else
bufsize = sizeof namebuf;
+#endif
buffer = SvGROW(bufsv, length+1);
/* 'offset' means 'flags' here */
length = recvfrom(PerlIO_fileno(IoIFP(io)), buffer, length, offset,
@@ -1283,7 +1287,11 @@ PP(pp_sysread)
#ifdef HAS_SOCKET__bad_code_maybe
if (IoTYPE(io) == 's') {
char namebuf[MAXPATHLEN];
+#if defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)
+ bufsize = sizeof (struct sockaddr_in);
+#else
bufsize = sizeof namebuf;
+#endif
length = recvfrom(PerlIO_fileno(IoIFP(io)), buffer+offset, length, 0,
(struct sockaddr *)namebuf, &bufsize);
}
@@ -1368,6 +1376,7 @@ PP(pp_send)
}
else
length = send(PerlIO_fileno(IoIFP(io)), buffer, blen, length);
+
#else
else
DIE(no_sock_func, "send");
@@ -1986,6 +1995,17 @@ PP(pp_getpeername)
case OP_GETPEERNAME:
if (getpeername(fd, (struct sockaddr *)SvPVX(sv), &len) < 0)
goto nuts2;
+#if defined(VMS_DO_SOCKETS) && defined (DECCRTL_SOCKETS)
+ {
+ static const char nowhere[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+ /* If the call succeeded, make sure we don't have a zeroed port/addr */
+ if (((struct sockaddr *)SvPVX(sv))->sa_family == AF_INET &&
+ !memcmp((char *)SvPVX(sv) + sizeof(u_short), nowhere,
+ sizeof(u_short) + sizeof(struct in_addr))) {
+ goto nuts2;
+ }
+ }
+#endif
break;
}
#ifdef BOGUS_GETNAME_RETURN