summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorMatt Kraai2000-09-20 04:33:30 +0000
committerMatt Kraai2000-09-20 04:33:30 +0000
commitb938e2ff99d90620dc14d606a80354ec0264c6c4 (patch)
treefff66909f28b5bf21183c8b17f7c90d3079ec140 /networking
parent46a98dfb138a55e5f7a94d7f7a82671c644a8368 (diff)
downloadbusybox-b938e2ff99d90620dc14d606a80354ec0264c6c4.zip
busybox-b938e2ff99d90620dc14d606a80354ec0264c6c4.tar.gz
Return failure if ping gets no response.
Diffstat (limited to 'networking')
-rw-r--r--networking/ping.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 5f44a68..f3ce6fb 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.23 2000/07/16 20:57:15 kraai Exp $
+ * $Id: ping.c,v 1.24 2000/09/20 04:33:30 kraai Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -279,6 +279,8 @@ static void unpack(char *, int, struct sockaddr_in *);
static void pingstats(int junk)
{
+ int status;
+
signal(SIGINT, SIG_IGN);
printf("\n--- %s ping statistics ---\n", hostname);
@@ -294,7 +296,11 @@ static void pingstats(int junk)
tmin / 10, tmin % 10,
(tsum / (nreceived + nrepeats)) / 10,
(tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10);
- exit(0);
+ if (nreceived != 0)
+ status = EXIT_SUCCESS;
+ else
+ status = EXIT_FAILURE;
+ exit(status);
}
static void sendping(int junk)