From 2a6ad5d1ff25bed25ed277df8420b08b88d8d140 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 11 Jul 2014 18:48:49 +0200 Subject: [PATCH] Avoids possible division by zero in the regression test. --- cmdline/mktest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmdline/mktest.c b/cmdline/mktest.c index a7eca327..2100ef43 100644 --- a/cmdline/mktest.c +++ b/cmdline/mktest.c @@ -64,7 +64,7 @@ void create_file(const char* path, int size) /* LCOV_EXCL_STOP */ } } else { - /* don't recreate a 0 file to avoid ZERO protection */ + /* don't truncate files to 0 size to avoid ZERO file size protection */ ++size; } @@ -292,6 +292,9 @@ void damage(const char* path, int size) /* LCOV_EXCL_STOP */ } + if (st.st_size == 0) + return; + if (S_ISREG(st.st_mode)) { /* file */ FILE* f;