stun

simple point to point tunnel
git clone git://git.2f30.org/stun
Log | Files | Refs | README

commit 3ea9ed0c0b188702df0a038c1063c182a1ab26d5
parent 9b6122cb92ce56964f328b533d5f748a428c5a7d
Author: sin <sin@2f30.org>
Date:   Tue, 21 Mar 2017 22:47:25 +0000

Don't error out on getaddrinfo() failure

Diffstat:
Mclient.c | 6++++--
Mserver.c | 6++++--
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/client.c b/client.c @@ -20,8 +20,10 @@ clientconnect(char *host, char *port) memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - if ((ret = getaddrinfo(host, port, &hints, &ai))) - logerr("getaddrinfo: %s", gai_strerror(ret)); + if ((ret = getaddrinfo(host, port, &hints, &ai))) { + logwarn("getaddrinfo: %s", gai_strerror(ret)); + return -1; + } for (p = ai; p; p = p->ai_next) { if (p->ai_family != aftype) diff --git a/server.c b/server.c @@ -24,8 +24,10 @@ serverinit(char *host, char *port) hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; - if ((ret = getaddrinfo(host, port, &hints, &ai))) - logerr("getaddrinfo: %s", gai_strerror(ret)); + if ((ret = getaddrinfo(host, port, &hints, &ai))) { + logwarn("getaddrinfo: %s", gai_strerror(ret)); + return -1; + } for (p = ai; p; p = p->ai_next) { if (p->ai_family != aftype)