fix no previous prototype warning
[oweals/busybox.git] / networking / traceroute.c
index 22d27f240fc17c53387ac1d91669fa97dfb8c644..e0f17a57f319f5b37ff8f5f7173a072c85a7835c 100644 (file)
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 /*
  * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000
  *      The Regents of the University of California.  All rights reserved.
 //#define CONFIG_FEATURE_TRACEROUTE_USE_ICMP
 
 #include <errno.h>
-#include <memory.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <malloc.h>
 #include <netdb.h>
 #include <endian.h>
 #include <getopt.h>
@@ -359,9 +358,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp)
        struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr;
        struct IFADDRLIST *st_ifaddrlist;
 
-       fd = socket(AF_INET, SOCK_DGRAM, 0);
-       if (fd < 0)
-               bb_perror_msg_and_die("socket");
+       fd = bb_xsocket(AF_INET, SOCK_DGRAM, 0);
 
        ifc.ifc_len = sizeof(ibuf);
        ifc.ifc_buf = (caddr_t)ibuf;
@@ -1091,8 +1088,7 @@ traceroute_main(int argc, char *argv[])
        if (n > 2)
                close(n);
 
-       if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0)
-               bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
+       s = bb_xsocket(AF_INET, SOCK_RAW, pe->p_proto);
 
 #ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
        if (op & USAGE_OP_DEBUG)
@@ -1103,9 +1099,7 @@ traceroute_main(int argc, char *argv[])
                (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on,
                    sizeof(on));
 
-       sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
-       if (sndsock < 0)
-               bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
+       sndsock = bb_xsocket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 
 #ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE
 #if defined(IP_OPTIONS)
@@ -1257,9 +1251,7 @@ traceroute_main(int argc, char *argv[])
 
        outip->ip_src = from->sin_addr;
 #ifndef IP_HDRINCL
-       if (bind(sndsock, (struct sockaddr *)from, sizeof(*from)) < 0) {
-               bb_perror_msg_and_die("bind");
-       }
+       bb_xbind(sndsock, (struct sockaddr *)from, sizeof(*from));
 #endif
 
        fprintf(stderr, "traceroute to %s (%s)", hostname, inet_ntoa(to->sin_addr));