Change 31427 by [EMAIL PROTECTED] on 2007/06/20 14:36:19

        Change #31426 should also be applied to the windows CE version

Affected files ...

... //depot/perl/win32/wincesck.c#2 edit

Differences ...

==== //depot/perl/win32/wincesck.c#2 (text) ====
Index: perl/win32/wincesck.c
--- perl/win32/wincesck.c#1~28061~      2006-05-02 07:28:31.000000000 -0700
+++ perl/win32/wincesck.c       2007-06-20 07:36:19.000000000 -0700
@@ -343,15 +343,19 @@
 win32_ioctl(int i, unsigned int u, char *data)
 {
     dTHX;
-    u_long argp = (u_long)data;
+    u_long u_long_arg; 
     int retval;
-
+    
     if (!wsock_started) {
        Perl_croak_nocontext("ioctl implemented only on sockets");
        /* NOTREACHED */
     }
 
-    retval = ioctlsocket(TO_SOCKET(i), (long)u, &argp);
+    /* mauke says using memcpy avoids alignment issues */
+    memcpy(&u_long_arg, data, sizeof u_long_arg); 
+    retval = ioctlsocket(TO_SOCKET(i), (long)u, &u_long_arg);
+    memcpy(data, &u_long_arg, sizeof u_long_arg);
+    
     if (retval == SOCKET_ERROR) {
        if (WSAGetLastError() == WSAENOTSOCK) {
            Perl_croak_nocontext("ioctl implemented only on sockets");
End of Patch.

Reply via email to