summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2003-06-02 10:01:59 +0000
committermaxim <maxim@FreeBSD.org>2003-06-02 10:01:59 +0000
commitc98e04ea6e7ea0335b1f0caaa2271e9b7386b028 (patch)
tree2e558721570a20f2e7fe7158bf934e1047bb94ec /sbin
parent2c37447c4126ef602971963f64a563b56ce4a27d (diff)
downloadFreeBSD-src-c98e04ea6e7ea0335b1f0caaa2271e9b7386b028.zip
FreeBSD-src-c98e04ea6e7ea0335b1f0caaa2271e9b7386b028.tar.gz
Fix SIGINFO handling: do not print incorrect timing statistics
when the data for it is not available. Founded by: ping -s0 localhost; press ^T
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 2d46089..750f74a 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1242,13 +1242,13 @@ check_status()
if (siginfo_p) {
siginfo_p = 0;
- (void)fprintf(stderr,
- "\r%ld/%ld packets received (%.0f%%) %.3f min / %.3f avg / %.3f max\n",
+ (void)fprintf(stderr, "\r%ld/%ld packets received (%.0f%%)",
nreceived, ntransmitted,
- ntransmitted ? nreceived * 100.0 / ntransmitted : 0.0,
- nreceived ? tmin : 0.0,
- nreceived + nrepeats ? tsum / (nreceived + nrepeats) : tsum,
- tmax);
+ ntransmitted ? nreceived * 100.0 / ntransmitted : 0.0);
+ if (nreceived && timing)
+ (void)fprintf(stderr, " %.3f min / %.3f avg / %.3f max",
+ tmin, tsum / (nreceived + nrepeats), tmax);
+ (void)fprintf(stderr, "\n");
}
}
OpenPOWER on IntegriCloud