summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2021-01-18 17:56:16 +0200
committerGitHub <noreply@github.com>2021-01-18 17:56:16 +0200
commit53c856d668a98430ec5cddad4b8e2d79b709abfa (patch)
treef810cbc9f399aeb091819887f55926cc4c4b2492 /daemon
parent10b745cba808ed2069ae51c23d75c02cf3ca3f65 (diff)
Fix coverity issue CID_365322
Add check to avoid DIV by zero (flagged in coverity)
Diffstat (limited to 'daemon')
-rw-r--r--daemon/unit_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/daemon/unit_test.c b/daemon/unit_test.c
index c26d177299..e6a69e354d 100644
--- a/daemon/unit_test.c
+++ b/daemon/unit_test.c
@@ -2196,6 +2196,8 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi
assert(0 == uv_thread_join(&query_threads[i]->thread));
}
test_duration = now_realtime_sec() - (time_start - HISTORY_SECONDS);
+ if (!test_duration)
+ test_duration = 1;
fprintf(stderr, "\nDB-engine stress test finished in %ld seconds.\n", test_duration);
unsigned long stored_metrics_nr = 0;
for (i = 0 ; i < DSET_CHARTS ; ++i) {