diff options
author | maxim <maxim@FreeBSD.org> | 2003-06-02 10:01:59 +0000 |
---|---|---|
committer | maxim <maxim@FreeBSD.org> | 2003-06-02 10:01:59 +0000 |
commit | c98e04ea6e7ea0335b1f0caaa2271e9b7386b028 (patch) | |
tree | 2e558721570a20f2e7fe7158bf934e1047bb94ec /sbin | |
parent | 2c37447c4126ef602971963f64a563b56ce4a27d (diff) | |
download | FreeBSD-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.c | 12 |
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"); } } |