summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2012-03-15 00:42:39 +0100
committerQuentin Carbonneaux2012-03-15 00:42:39 +0100
commit15ec7fd992fc9943740da3d90aec084e13b4392e (patch)
tree9a8b597ab105b94f0f5d494c629ff3764479eb3a
parent3597152e7424b24233a60fe1b7492e8ee178d08f (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.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/irc.c b/irc.c
index 2136e22..9a5b4e5 100644
--- a/irc.c
+++ b/irc.c
@@ -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);