Fix SIGINFO handling: do not print incorrect timing statistics

when the data for it is not available.

Founded by:	ping -s0 localhost; press ^T
This commit is contained in:
Maxim Konovalov 2003-06-02 10:01:59 +00:00
parent d68d53d4d6
commit aed98a27fd

View File

@ -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");
}
}