aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-09-20 04:33:30 +0000
committerMatt Kraai <kraai@debian.org>2000-09-20 04:33:30 +0000
commitb938e2ff99d90620dc14d606a80354ec0264c6c4 (patch)
treefff66909f28b5bf21183c8b17f7c90d3079ec140
parent46a98dfb138a55e5f7a94d7f7a82671c644a8368 (diff)
downloadbusybox-w32-b938e2ff99d90620dc14d606a80354ec0264c6c4.tar.gz
busybox-w32-b938e2ff99d90620dc14d606a80354ec0264c6c4.tar.bz2
busybox-w32-b938e2ff99d90620dc14d606a80354ec0264c6c4.zip
Return failure if ping gets no response.
-rw-r--r--networking/ping.c10
-rw-r--r--ping.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 5f44a6816..f3ce6fb80 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.23 2000/07/16 20:57:15 kraai Exp $ 3 * $Id: ping.c,v 1.24 2000/09/20 04:33:30 kraai 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>
@@ -279,6 +279,8 @@ static void unpack(char *, int, struct sockaddr_in *);
279 279
280static void pingstats(int junk) 280static void pingstats(int junk)
281{ 281{
282 int status;
283
282 signal(SIGINT, SIG_IGN); 284 signal(SIGINT, SIG_IGN);
283 285
284 printf("\n--- %s ping statistics ---\n", hostname); 286 printf("\n--- %s ping statistics ---\n", hostname);
@@ -294,7 +296,11 @@ static void pingstats(int junk)
294 tmin / 10, tmin % 10, 296 tmin / 10, tmin % 10,
295 (tsum / (nreceived + nrepeats)) / 10, 297 (tsum / (nreceived + nrepeats)) / 10,
296 (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10); 298 (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10);
297 exit(0); 299 if (nreceived != 0)
300 status = EXIT_SUCCESS;
301 else
302 status = EXIT_FAILURE;
303 exit(status);
298} 304}
299 305
300static void sendping(int junk) 306static void sendping(int junk)
diff --git a/ping.c b/ping.c
index 5f44a6816..f3ce6fb80 100644
--- a/ping.c
+++ b/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.23 2000/07/16 20:57:15 kraai Exp $ 3 * $Id: ping.c,v 1.24 2000/09/20 04:33:30 kraai 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>
@@ -279,6 +279,8 @@ static void unpack(char *, int, struct sockaddr_in *);
279 279
280static void pingstats(int junk) 280static void pingstats(int junk)
281{ 281{
282 int status;
283
282 signal(SIGINT, SIG_IGN); 284 signal(SIGINT, SIG_IGN);
283 285
284 printf("\n--- %s ping statistics ---\n", hostname); 286 printf("\n--- %s ping statistics ---\n", hostname);
@@ -294,7 +296,11 @@ static void pingstats(int junk)
294 tmin / 10, tmin % 10, 296 tmin / 10, tmin % 10,
295 (tsum / (nreceived + nrepeats)) / 10, 297 (tsum / (nreceived + nrepeats)) / 10,
296 (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10); 298 (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10);
297 exit(0); 299 if (nreceived != 0)
300 status = EXIT_SUCCESS;
301 else
302 status = EXIT_FAILURE;
303 exit(status);
298} 304}
299 305
300static void sendping(int junk) 306static void sendping(int junk)