diff options
| author | Quentin Carbonneaux | 2012-03-15 00:42:39 +0100 |
|---|---|---|
| committer | Quentin Carbonneaux | 2012-03-15 00:42:39 +0100 |
| commit | 15ec7fd992fc9943740da3d90aec084e13b4392e (patch) | |
| tree | 9a8b597ab105b94f0f5d494c629ff3764479eb3a | |
| parent | 3597152e7424b24233a60fe1b7492e8ee178d08f (diff) | |
Zero all the hints before calling getaddrinfo.
Testing the program on NetBSD made getaddrinfo whine because all non
filled elements of the struct addrinfo given as hints must be zeros (or
null pointers). Except this point, irc.c seems to work like charm on
NetBSD.
| -rw-r--r-- | irc.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -119,11 +119,10 @@ dial(const char *host, short port) { int f; struct sockaddr_in sin; - struct addrinfo *ai, hai; + struct addrinfo *ai, hai = { 0 }; hai.ai_family = AF_INET; hai.ai_socktype = SOCK_STREAM; - hai.ai_flags = hai.ai_protocol = 0; if (getaddrinfo(host, 0, &hai, &ai)) panic("Cannot resolve host."); memcpy(&sin, ai->ai_addr, sizeof sin); |
