Zero all the hints before calling getaddrinfo. - irc - IRC client based on c9x.me/irc client
HTML git clone git://git.codemadness.org/irc
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 15ec7fd992fc9943740da3d90aec084e13b4392e
DIR parent 3597152e7424b24233a60fe1b7492e8ee178d08f
HTML Author: Quentin Carbonneaux <qcarbonneaux@gmail.com>
Date: Thu, 15 Mar 2012 00:42:39 +0100
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.
Diffstat:
M irc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
DIR diff --git 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);