AIX doesn't set the length in getsockopt.
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 23 Sep 2014 12:17:47 +0000 (08:17 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 23 Sep 2014 12:29:53 +0000 (08:29 -0400)
[perl #120835] and [rt #91183] and [rt #85570]

Seen errors in blead smoke in AIX 6.1:

cpan/IO-Socket-IP/t/18fdopen .................................. Argument
"\0\0\0^A\0\0\0r\0\0\0\0\0\0\0\0?M-^U\0\0M-^E^[^???\0^N\0..." isn't
numeric in numeric eq (==) at ../../lib/IO/Socket/IP.pm line 748.

cpan/IO-Socket-IP/t/31nonblocking-connect-internet ............ Argument
"\0\0\0\0\0\0\0\0?\0\n^B1?\0\0\0^B\0^BM-\rf?^H?\0^N\0^B?|..." isn't
numeric in scalar assignment at ../../lib/IO/Socket/IP.pm line 707.

pp_sys.c

index ac2a87c..014ec42 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2676,6 +2676,11 @@ PP(pp_ssockopt)
        len = SvCUR(sv);
        if (PerlSock_getsockopt(fd, lvl, optname, SvPVX(sv), &len) < 0)
            goto nuts2;
+#if defined(_AIX)
+        /* XXX Configure test: does getsockopt set the length properly? */
+        if (len == 256)
+            len = sizeof(int);
+#endif
        SvCUR_set(sv, len);
        *SvEND(sv) ='\0';
        PUSHs(sv);