]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
cleanup: remove obsolete herror() function
authorSami Kerola <kerolasa@iki.fi>
Sat, 20 Aug 2016 08:17:06 +0000 (09:17 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sun, 21 Aug 2016 14:57:21 +0000 (15:57 +0100)
Applications should use getaddrinfo(3), getnameinfo(3), and gai_strerror(3)
instead.  Systems without getaddrinfo() are from now on considered too
broken to be supported.  These include for example platforms: HP-UX 11.11,
IRIX 6.5, OSF/1 5.1, Solaris 7, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5,
and BeOS.

configure.ac
mtr.c

index ea9e1ceef802a634fedbcf096fe5f4386bbffa21..98f0c6375bc9ab0f30b9d5420b92f63187ad60be 100644 (file)
@@ -122,10 +122,7 @@ AC_CHECK_FUNC([res_query], [RESOLV_LIBS=""], [
 ])
 AC_SUBST([RESOLV_LIBS])
 
-# Error printing functions.
-AC_CHECK_FUNC([herror], [],
-  [AC_DEFINE([NO_HERROR], [1], [Define if you don't have the herror() function available.])])
-
+# Check errno and socket data types.
 AC_CHECK_DECLS([errno], [], [], [[
 #include <errno.h>
 #include <sys/errno.h>
diff --git a/mtr.c b/mtr.c
index d6d3a4b3e18abba07a5cee4f0cd14ed8e73302ac..cc015377c633e2cf1706e53d658808175b72c8c2 100644 (file)
--- a/mtr.c
+++ b/mtr.c
 #endif
 
 
-#ifdef NO_HERROR
-#define herror(str) fprintf(stderr, str ": error looking up \"%s\"\n", Hostname);
-#endif
-
-
 int   DisplayMode;
 int   display_mode;
 int   Interactive = 1;
@@ -642,12 +637,12 @@ int main(int argc, char **argv)
 {
   struct hostent *  host                = NULL;
   int               net_preopen_result;
-#ifdef ENABLE_IPV6
   struct addrinfo       hints, *res;
   int                   error;
   struct hostent        trhost;
   char *                alptr[2];
   struct sockaddr_in *  sa4;
+#ifdef ENABLE_IPV6
   struct sockaddr_in6 * sa6;
 #endif
 
@@ -726,7 +721,6 @@ int main(int argc, char **argv)
       }
     }
 
-#ifdef ENABLE_IPV6
     /* gethostbyname2() is deprecated so we'll use getaddrinfo() instead. */
     memset( &hints, 0, sizeof hints );
     hints.ai_family = af;
@@ -758,10 +752,12 @@ int main(int argc, char **argv)
       sa4 = (struct sockaddr_in *) res->ai_addr;
       alptr[0] = (void *) &(sa4->sin_addr);
       break;
+#ifdef ENABLE_IPV6
     case AF_INET6:
       sa6 = (struct sockaddr_in6 *) res->ai_addr;
       alptr[0] = (void *) &(sa6->sin6_addr);
       break;
+#endif
     default:
       fprintf( stderr, "mtr unknown address type\n" );
       if ( DisplayMode != DisplayCSV ) exit(EXIT_FAILURE);
@@ -771,18 +767,6 @@ int main(int argc, char **argv)
       }
     }
     alptr[1] = NULL;
-#else
-      host = gethostbyname(Hostname);
-    if (host == NULL) {
-      herror("mtr gethostbyname");
-      if ( DisplayMode != DisplayCSV ) exit(EXIT_FAILURE);
-      else {
-        names = names->next;
-        continue;
-      }
-    }
-    af = host->h_addrtype;
-#endif
 
     if (net_open(host) != 0) {
       fprintf(stderr, "mtr: Unable to start net module.\n");