X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnetutl.c;h=7a214702b4e072336bf3c04a3295726d1208cc1f;hp=cd50792feafed8502b4c36ca9ce127419c80e452;hb=9bde92ce97d5503ff2d31dcc6f0648902580ec14;hpb=83263b74460656ba557fd9bb84dc27258549e9cd diff --git a/src/netutl.c b/src/netutl.c index cd50792f..7a214702 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.12.4.49 2003/07/24 12:08:15 guus Exp $ + $Id: netutl.c,v 1.12.4.52 2003/08/03 12:38:43 guus Exp $ */ #include "system.h" @@ -36,20 +36,18 @@ bool hostnames = false; */ struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) { - struct addrinfo hint, *ai; + struct addrinfo *ai, hint = {0}; int err; cp(); - memset(&hint, 0, sizeof(hint)); - hint.ai_family = addressfamily; hint.ai_socktype = socktype; err = getaddrinfo(address, service, &hint, &ai); if(err) { - logger(LOG_WARNING, _("Error looking up %s port %s: %s\n"), address, + logger(LOG_WARNING, _("Error looking up %s port %s: %s"), address, service, gai_strerror(err)); return NULL; } @@ -59,14 +57,12 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock sockaddr_t str2sockaddr(const char *address, const char *port) { - struct addrinfo hint, *ai; + struct addrinfo *ai, hint = {0}; sockaddr_t result; int err; cp(); - memset(&hint, 0, sizeof(hint)); - hint.ai_family = AF_UNSPEC; hint.ai_flags = AI_NUMERICHOST; hint.ai_socktype = SOCK_STREAM; @@ -74,7 +70,7 @@ sockaddr_t str2sockaddr(const char *address, const char *port) err = getaddrinfo(address, port, &hint, &ai); if(err || !ai) { - logger(LOG_ERR, _("Error looking up %s port %s: %s\n"), address, port, + logger(LOG_ERR, _("Error looking up %s port %s: %s"), address, port, gai_strerror(err)); cp_trace(); raise(SIGFPE);