From ad024040fcb6101b5ca6efbc9265accdee7e2c2d Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 5 May 2012 18:37:49 +0200 Subject: [PATCH] test: prevent accidental division by zero --- test/runner.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/runner.c b/test/runner.c index 34e566ec..78b0f211 100644 --- a/test/runner.c +++ b/test/runner.c @@ -28,6 +28,9 @@ char executable_path[PATHMAX] = { '\0' }; static void log_progress(int total, int passed, int failed, const char* name) { + if (total == 0) + total = 1; + LOGF("[%% %3d|+ %3d|- %3d]: %s", (passed + failed) / total * 100, passed, failed, name); }