diff options
author | tiptorrent development team <tiptorrent@soleta.eu> | 2021-09-23 22:44:10 +0200 |
---|---|---|
committer | tiptorrent development team <tiptorrent@soleta.eu> | 2021-09-23 22:45:04 +0200 |
commit | 3adc9338d1b68959453b46c36bf76a5e835cbd28 (patch) | |
tree | e6462c0610da134f31c5643ab6d8f8ac7109acf0 | |
parent | cc0caf947466fcfd73bacbf77defccf65f6964cd (diff) |
floating exception if download is too fast
fix divide by zero if file download takes less than 1 second.
-rw-r--r-- | src/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -471,7 +471,7 @@ int main(int argc, char *argv[]) syslog(LOG_INFO, "Done in %lu.%06lu seconds (%lu Mbytes/second). " "Direct from server: %u Redirected: %u\n", tv.tv_sec, tv.tv_usec, - data_len / 1024000 / tv.tv_sec, + tv.tv_sec > 0 ? data_len / 1024000 / tv.tv_sec : data_len / 1024000, tip_client_stats.direct_from_server, tip_client_stats.redirects); return EXIT_SUCCESS; @@ -481,7 +481,7 @@ int main(int argc, char *argv[]) syslog(LOG_INFO, "Failure after %lu.%06lu seconds (%lu Mbytes/second). " "Direct from server: %u Redirected: %u\n", tv.tv_sec, tv.tv_usec, - data_len / 1024000 / tv.tv_sec, + tv.tv_sec > 0 ? data_len / 1024000 / tv.tv_sec : data_len / 1024000, tip_client_stats.direct_from_server, tip_client_stats.redirects); return EXIT_FAILURE; |