From aaab96c5d7b7fa90701dbcade286cad8a1518889 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Wed, 28 Jul 2010 00:50:41 +0000 Subject: Fix getting data out of gethostbyname; should fix #69 --- server/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/main.c') diff --git a/server/main.c b/server/main.c index 111ae0e..0086923 100644 --- a/server/main.c +++ b/server/main.c @@ -459,13 +459,13 @@ do_net_setup(void) return 1; } hp = gethostbyname(hostname); - if (!hp) { + if (!hp || hp->h_addrtype != AF_INET) { syslog(LOG_ERR, "no gethostbyname repsonse"); strncpy(myname, hostname, MAXHOSTNAMELEN); return 1; } strncpy(myname, hp->h_name, MAXHOSTNAMELEN); - memcpy(&my_addr, hp->h_addr, sizeof(hp->h_addr)); + memcpy(&my_addr, hp->h_addr_list[0], hp->h_length); setservent(1); /* keep file/connection open */ -- cgit v1.2.3