Created
August 29, 2009 03:23
-
-
Save josephruscio/177373 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -283,7 +283,10 @@ inet_connect(int s, const char *hname, uint16_t port) | |
{ | |
struct addrinfo *lookup_result=NULL; | |
struct addrinfo hints; | |
- struct sockaddr_storage dest_addr; | |
+ union { | |
+ struct sockaddr_storage sa_stor; | |
+ struct sockaddr_in sa_in; | |
+ } dest_addr; | |
struct sockaddr_in *dest_in; | |
int v; | |
@@ -302,18 +305,19 @@ inet_connect(int s, const char *hname, uint16_t port) | |
} | |
- dest_in = (struct sockaddr_in *) &dest_addr; | |
+ dest_in = &dest_addr.sa_in; | |
dest_in->sin_port = htons(port); | |
connect(s, (struct sockaddr*) &dest_addr, sizeof(dest_addr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment