diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-07-12 20:26:32 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-07-12 20:26:32 +0000 |
commit | 7467c8d3b6a50e2cbd8db750963d40b420ad38d1 (patch) | |
tree | 10dcece1e0bb88e35aa95c3a68896ad426e43f7a /networking/ping.c | |
parent | f69bfc76fa7acb0c87fa3f3b319fde361a8315a8 (diff) | |
download | busybox-w32-7467c8d3b6a50e2cbd8db750963d40b420ad38d1.tar.gz busybox-w32-7467c8d3b6a50e2cbd8db750963d40b420ad38d1.tar.bz2 busybox-w32-7467c8d3b6a50e2cbd8db750963d40b420ad38d1.zip |
Patch from vodz:
Changed email address
cmdedit API change
optimizations for traceroute and md5sum
added a new shared create_icmp_socket() function
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/networking/ping.c b/networking/ping.c index e4307d2de..205133d8c 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.43 2001/05/21 20:30:51 andersen Exp $ | 3 | * $Id: ping.c,v 1.44 2001/07/12 20:26:31 andersen Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -191,11 +191,7 @@ static void ping(const char *host) | |||
191 | int pingsock, c; | 191 | int pingsock, c; |
192 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; | 192 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; |
193 | 193 | ||
194 | if ((pingsock = socket(AF_INET, SOCK_RAW, 1)) < 0) /* 1 == ICMP */ | 194 | pingsock = create_raw_socket(); |
195 | perror_msg_and_die("creating a raw socket"); | ||
196 | |||
197 | /* drop root privs if running setuid */ | ||
198 | setuid(getuid()); | ||
199 | 195 | ||
200 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); | 196 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); |
201 | 197 | ||
@@ -434,7 +430,7 @@ static void ping(const char *host) | |||
434 | if (errno == EPERM) | 430 | if (errno == EPERM) |
435 | error_msg_and_die("permission denied. (are you root?)"); | 431 | error_msg_and_die("permission denied. (are you root?)"); |
436 | else | 432 | else |
437 | perror_msg_and_die("creating a raw socket"); | 433 | perror_msg_and_die(can_not_create_raw_socket); |
438 | } | 434 | } |
439 | 435 | ||
440 | /* drop root privs if running setuid */ | 436 | /* drop root privs if running setuid */ |