Avoid floating point divide by 0 in ctdb_fetch.c's bench_fetch().
authorMartin Schwenke <martin@meltin.net>
Tue, 21 Apr 2009 06:50:37 +0000 (16:50 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 12 May 2009 04:45:14 +0000 (14:45 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
tests/src/ctdb_fetch.c

index aab4fe118f9aa12f2db30da569e2ec48433e9c27..eecbb8416ad069d6a727af8a02bd14480ba2aee8 100644 (file)
@@ -132,7 +132,7 @@ static void bench_fetch(struct ctdb_context *ctdb, struct event_context *ev)
        start_timer();
 
        while (end_timer() < timelimit) {
-               if (pnn == 0 && msg_count % 100 == 0) {
+               if (pnn == 0 && msg_count % 100 == 0 && end_timer() > 0) {
                        printf("Fetch: %.2f msgs/sec\r", msg_count/end_timer());
                        fflush(stdout);
                }