summaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-11-29 16:09:56 +0000
committerdg <dg@FreeBSD.org>1994-11-29 16:09:56 +0000
commit2350bbf295463f5bfd35d0f1af489c68243ef7a6 (patch)
treea190e01cbe99ece0d468fdb44aa007e29e9452e4 /sbin/ping
parentb360c63549f36ae42b45946e378dc4b07eec3b25 (diff)
downloadFreeBSD-src-2350bbf295463f5bfd35d0f1af489c68243ef7a6.zip
FreeBSD-src-2350bbf295463f5bfd35d0f1af489c68243ef7a6.tar.gz
In past releases of FreeBSD, I have used the exit status of "ping" to
determine whether a connection to a given machine is up or not. In FreeBSD 2.0 (and therefore, I assume, BSD 4.4) the exit code of ping is always zero, even if no packets were received. I would like to propose the following change to /usr/src/sbin/ping/ping.c to restore this useful behaviour: Submitted by: Denis Fortin
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index b7aebfe..256d704 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -755,7 +755,10 @@ finish()
tcsetattr (0, TCSANOW, &ts);
}
- exit(0);
+ if (nreceived)
+ exit(0);
+ else
+ exit(2);
}
#ifdef notdef
OpenPOWER on IntegriCloud