]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2image: avoid potential divide by zero
authorTheodore Ts'o <tytso@mit.edu>
Fri, 3 Jan 2014 02:15:20 +0000 (21:15 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 5 Jan 2014 00:11:37 +0000 (19:11 -0500)
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" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
misc/e2image.c

index ac62ffec7165b8da06b88a4d48e3bc24d86e6b74..6c5113779bcf940efd742f403223014a7737d4cb 100644 (file)
@@ -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];