From: fredrik Date: Thu, 27 Apr 2006 15:27:51 +0000 (+0000) Subject: Check for error return from getaddrinfo... X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=5bd036b52f6cfa5dfbfe43f487fcc61821dd6ed6;p=icmp-dn.git Check for error return from getaddrinfo... git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/icmp-dn@605 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/src/idnlookup.c b/src/idnlookup.c index b120c52..4866c81 100644 --- a/src/idnlookup.c +++ b/src/idnlookup.c @@ -157,7 +157,10 @@ int main(int argc, char **argv) memset(&aihint, 0, sizeof(aihint)); aihint.ai_socktype = SOCK_RAW; aihint.ai_protocol = IPPROTO_ICMP; - ret = getaddrinfo(argv[optind], NULL, &aihint, &ai); + if((ret = getaddrinfo(argv[optind], NULL, &aihint, &ai)) != 0) { + fprintf(stderr, "%s: %s\n", argv[optind], gai_strerror(ret)); + exit(1); + } for(cai = ai; cai != NULL; cai = cai->ai_next) { if((s = socket(cai->ai_family, SOCK_RAW, IPPROTO_ICMP)) < 0) {