From: Theodore Ts'o Date: Fri, 3 Jan 2014 02:15:20 +0000 (-0500) Subject: e2image: avoid potential divide by zero X-Git-Tag: v1.42.10~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa24c8faa14241e965cc91888fc4cfe374f4ea55;p=thirdparty%2Fe2fsprogs.git e2image: avoid potential divide by zero It's highly unlikely after five seconds that zero blocks would have been written, but let's silence the Coverity warning. Addresses-Coverity-ID: 1147780 Signed-off-by: "Theodore Ts'o" Reviewed-by: Eric Sandeen --- diff --git a/misc/e2image.c b/misc/e2image.c index ac62ffec7..6c5113779 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -634,7 +634,7 @@ more_blocks: bscount = print_progress(total_written, meta_blocks_count); duration = time(NULL) - start_time; - if (duration > 5) { + if (duration > 5 && total_written) { time_t est = (duration * meta_blocks_count / total_written) - duration; char buff[30];