diff options
author | Tim Riker <tim@rikers.org> | 2002-05-18 09:16:04 +0000 |
---|---|---|
committer | Tim Riker <tim@rikers.org> | 2002-05-18 09:16:04 +0000 |
commit | c6def44cfc0de0f5eb3cafb2909908097d6d9e4b (patch) | |
tree | 771fd8be2d2035d464eb1e3152a46a3dc9243148 | |
parent | 13c26fc1a55df2b97062cf370547c4d656e70957 (diff) | |
download | busybox-w32-c6def44cfc0de0f5eb3cafb2909908097d6d9e4b.tar.gz busybox-w32-c6def44cfc0de0f5eb3cafb2909908097d6d9e4b.tar.bz2 busybox-w32-c6def44cfc0de0f5eb3cafb2909908097d6d9e4b.zip |
ping return 1 if can't ping
-rw-r--r-- | networking/ping.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/ping.c b/networking/ping.c index e3ba2ed27..dd5596486 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.50 2002/03/21 14:04:43 andersen Exp $ | 3 | * $Id: ping.c,v 1.51 2002/05/18 09:16:04 timr 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> |
@@ -147,7 +147,7 @@ static const int PINGINTERVAL = 1; /* second */ | |||
147 | #define CLR(bit) (A(bit) &= (~B(bit))) | 147 | #define CLR(bit) (A(bit) &= (~B(bit))) |
148 | #define TST(bit) (A(bit) & B(bit)) | 148 | #define TST(bit) (A(bit) & B(bit)) |
149 | 149 | ||
150 | static void ping(const char *host); | 150 | static int ping(const char *host); |
151 | 151 | ||
152 | /* common routines */ | 152 | /* common routines */ |
153 | static int in_cksum(unsigned short *buf, int sz) | 153 | static int in_cksum(unsigned short *buf, int sz) |
@@ -414,7 +414,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
414 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | 414 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); |
415 | } | 415 | } |
416 | 416 | ||
417 | static void ping(const char *host) | 417 | static int ping(const char *host) |
418 | { | 418 | { |
419 | char packet[datalen + MAXIPLEN + MAXICMPLEN]; | 419 | char packet[datalen + MAXIPLEN + MAXICMPLEN]; |
420 | int sockopt; | 420 | int sockopt; |
@@ -468,6 +468,7 @@ static void ping(const char *host) | |||
468 | break; | 468 | break; |
469 | } | 469 | } |
470 | pingstats(0); | 470 | pingstats(0); |
471 | return(nreceived > 0); | ||
471 | } | 472 | } |
472 | 473 | ||
473 | extern int ping_main(int argc, char **argv) | 474 | extern int ping_main(int argc, char **argv) |
@@ -509,8 +510,7 @@ extern int ping_main(int argc, char **argv) | |||
509 | show_usage(); | 510 | show_usage(); |
510 | 511 | ||
511 | myid = getpid() & 0xFFFF; | 512 | myid = getpid() & 0xFFFF; |
512 | ping(*argv); | 513 | return ping(*argv); |
513 | return EXIT_SUCCESS; | ||
514 | } | 514 | } |
515 | #endif /* ! CONFIG_FEATURE_FANCY_PING */ | 515 | #endif /* ! CONFIG_FEATURE_FANCY_PING */ |
516 | 516 | ||