From ec917955526b77ce77ae18ff189f592f86fafba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Sun, 17 Aug 2003 07:28:53 +0000 Subject: [PATCH] ipv6 connect sanity checking: error message if not able to connect, instead of just segfaulting. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@442 423420c4-83ab-492f-b58f-81f9feb106b5 --- tcp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tcp.c b/tcp.c index 79dcb99..822184a 100644 --- a/tcp.c +++ b/tcp.c @@ -147,7 +147,7 @@ tcp_connect(char *server) if (n < 0) { - error("getaddrinfo error:: [%s]\n", gai_strerror(n)); + error("getaddrinfo: %s\n", gai_strerror(n)); return False; } @@ -167,6 +167,12 @@ tcp_connect(char *server) } freeaddrinfo(ressave); + if (sock == -1) + { + error("%s: unable to connect\n", server); + return False; + } + #else /* no IPv6 support */ struct hostent *nslookup;