summaryrefslogtreecommitdiff
path: root/networking/traceroute.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-04-12 17:55:51 +0000
committerBernhard Reutner-Fischer2006-04-12 17:55:51 +0000
commitdac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch)
tree0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /networking/traceroute.c
parent79865bc5077cf6d17b27e9599921d4c85b1575fd (diff)
downloadbusybox-dac7ff15b7d32deeeef3d9665744fc5774c21d70.zip
busybox-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.gz
- patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it. Also use shorter boilerplate while at it.
Diffstat (limited to 'networking/traceroute.c')
-rw-r--r--networking/traceroute.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 22d27f2..0abd904 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -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.
@@ -359,9 +360,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 +1090,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 +1101,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)