aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-08-09 23:22:48 +1200
committerDavid Phillips <david@sighup.nz>2017-08-09 23:22:48 +1200
commitb4866cd9c59f2ee63e92d732a1f29ca042fe1b32 (patch)
tree7cb2361cafdc0e5cc1eed97eff01d477afd828b5
parentec10cc62dd023e9388d0f8880d968cd6d1ecfc7f (diff)
downloadsand-leek-b4866cd9c59f2ee63e92d732a1f29ca042fe1b32.tar.xz
Remove division by zero if no loops complete
-rw-r--r--sand-leek.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sand-leek.c b/sand-leek.c
index e5cf227..290bd09 100644
--- a/sand-leek.c
+++ b/sand-leek.c
@@ -225,9 +225,9 @@ monitor_progress(unsigned long volatile *khashes, int thread_count) {
}
fprintf(stderr, "Last second: %lu kH/s (%.2f kH/s/thread) | Average: %.2f kH/s (%.2f kH/s/thread)\r",
total_khashes - last_total_khashes,
- (double)(total_khashes - last_total_khashes) / thread_count,
- (double)total_khashes / loops,
- ((double)total_khashes / loops) / thread_count);
+ (double)(total_khashes - last_total_khashes) / (thread_count || 1),
+ (double)total_khashes / (loops || 1),
+ ((double)total_khashes / (loops || 1)) / (thread_count || 1));
sleep(1);
loops++;
}