journal: avoid undefined behaviour in float division by 0.0

Coverity says that's undefined. I'm pretty sure we always would get a nan, but
let's avoid (formally) undefined behaviour since that can cause compilers to do
strange things.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-11-28 21:34:50 +01:00
parent b921fcb2ac
commit 2504834861
+1 -1
View File
@@ -667,7 +667,7 @@ int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
log_debug("LZ4 decompression finished (%zu -> %zu bytes, %.1f%%)",
total_in, total_out,
(double) total_out / total_in * 100);
total_in > 0 ? (double) total_out / total_in * 100 : 0.0);
cleanup:
munmap(src, st.st_size);
return r;