diff options
-rw-r--r-- | src/input/input_net.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/input/input_net.c b/src/input/input_net.c index 5c927a6d5..82ab28c1e 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -113,7 +113,10 @@ typedef struct { static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine) { int s; - struct sockaddr_in sin; + union { + struct sockaddr_in in; + struct sockaddr sa; + } sa; s = xine_socket_cloexec(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s==-1) { @@ -122,14 +125,14 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine) return -1; } - sin.sin_family = AF_INET; - sin.sin_addr = ia; - sin.sin_port = htons(port); + sa.in.sin_family = AF_INET; + sa.in.sin_addr = ia; + sa.in.sin_port = htons(port); #ifndef WIN32 - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) + if (connect(s, &sa.sa, sizeof(sa.in))==-1 && errno != EINPROGRESS) #else - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS) + if (connect(s, &sa.sa, sizeof(sa.in))==-1 && WSAGetLastError() != WSAEINPROGRESS) #endif { xine_log(xine, XINE_LOG_MSG, |