Fix coverity issue CID_365322
Add check to avoid DIV by zero (flagged in coverity)
Stelios Fragkakis committed
Jan 18, 2021 at 17:56 UTC
53c856d668a98430ec5cddad4b8e2d79b709abfa
1 file changed
+2
daemon/unit_test.c
+2
@@ -2196,6 +2196,8 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi
2196
assert(0 == uv_thread_join(&query_threads[i]->thread));
2197
}
2198
test_duration = now_realtime_sec() - (time_start - HISTORY_SECONDS);
2199
+ if (!test_duration)
2200
+ test_duration = 1;
2201
fprintf(stderr, "\nDB-engine stress test finished in %ld seconds.\n", test_duration);
2202
unsigned long stored_metrics_nr = 0;
2203
for (i = 0 ; i < DSET_CHARTS ; ++i) {