summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-06-20 14:36:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-06-20 14:36:19 +0000
commitd1b0f6034d6ba11b3431428d8dac3200d6b2b02b (patch)
tree68c2a7c81aaa7bf83069ae57b1fd5aac4c32182a
parent69a143a617ef4a2e1a3b3a29a66e4b9c956cf3ca (diff)
downloadperl-d1b0f6034d6ba11b3431428d8dac3200d6b2b02b.tar.gz
Change #31426 should also be applied to the windows CE version
p4raw-id: //depot/perl@31427
-rw-r--r--win32/wincesck.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/win32/wincesck.c b/win32/wincesck.c
index 8f2a90b8ca..76d56fc4b9 100644
--- a/win32/wincesck.c
+++ b/win32/wincesck.c
@@ -343,15 +343,19 @@ int
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");