From: Jonathan Hudson Date: Thu, 22 May 1997 05:56:26 +0000 (+1200) Subject: lib/io_udp.t fails on VMS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=490ab354c465618bcdee84ecc1d256c265518f0a;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/pp_sys.c b/pp_sys.c index 03a10fe..5e1f427 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