aboutsummaryrefslogtreecommitdiff
path: root/networking/traceroute.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
commitdac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch)
tree0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /networking/traceroute.c
parent79865bc5077cf6d17b27e9599921d4c85b1575fd (diff)
downloadbusybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.gz
busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.bz2
busybox-w32-dac7ff15b7d32deeeef3d9665744fc5774c21d70.zip
- 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 22d27f240..0abd9047d 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -1,3 +1,4 @@
1/* vi: set sw=4 ts=4: */
1/* 2/*
2 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000 3 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -359,9 +360,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp)
359 struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr; 360 struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr;
360 struct IFADDRLIST *st_ifaddrlist; 361 struct IFADDRLIST *st_ifaddrlist;
361 362
362 fd = socket(AF_INET, SOCK_DGRAM, 0); 363 fd = bb_xsocket(AF_INET, SOCK_DGRAM, 0);
363 if (fd < 0)
364 bb_perror_msg_and_die("socket");
365 364
366 ifc.ifc_len = sizeof(ibuf); 365 ifc.ifc_len = sizeof(ibuf);
367 ifc.ifc_buf = (caddr_t)ibuf; 366 ifc.ifc_buf = (caddr_t)ibuf;
@@ -1091,8 +1090,7 @@ traceroute_main(int argc, char *argv[])
1091 if (n > 2) 1090 if (n > 2)
1092 close(n); 1091 close(n);
1093 1092
1094 if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0) 1093 s = bb_xsocket(AF_INET, SOCK_RAW, pe->p_proto);
1095 bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
1096 1094
1097#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG 1095#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
1098 if (op & USAGE_OP_DEBUG) 1096 if (op & USAGE_OP_DEBUG)
@@ -1103,9 +1101,7 @@ traceroute_main(int argc, char *argv[])
1103 (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on, 1101 (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on,
1104 sizeof(on)); 1102 sizeof(on));
1105 1103
1106 sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); 1104 sndsock = bb_xsocket(AF_INET, SOCK_RAW, IPPROTO_RAW);
1107 if (sndsock < 0)
1108 bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket);
1109 1105
1110#ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE 1106#ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE
1111#if defined(IP_OPTIONS) 1107#if defined(IP_OPTIONS)