detect/stat: Display 0 instead of nan

This commit updates the summary message when Suricata terminates.
Without this commit, "nan" was displayed if there were no drops/packets
pull/9148/head
Jeff Lucovsky 2 years ago
parent ebdf482580
commit cb30b7185f

@ -321,7 +321,9 @@ int LiveDeviceListClean(void)
SCLogNotice("%s: packets: %" PRIu64 ", drops: %" PRIu64
" (%.2f%%), invalid chksum: %" PRIu64,
pd->dev, SC_ATOMIC_GET(pd->pkts), SC_ATOMIC_GET(pd->drop),
100 * ((double)SC_ATOMIC_GET(pd->drop)) / (double)SC_ATOMIC_GET(pd->pkts),
SC_ATOMIC_GET(pd->pkts) > 0 ? 100 * ((double)SC_ATOMIC_GET(pd->drop)) /
(double)SC_ATOMIC_GET(pd->pkts)
: 0,
SC_ATOMIC_GET(pd->invalid_checksums));
}

Loading…
Cancel
Save