If files are created while e4defrag is running, it's quite possible
for succeed_cnt to be larger than total_count, in which case the
number of failures (calculated via total_count - succeed_cnt) will
overflow and become a very large unsigned number.
The way we calculate statistics is a bit silly, since when recurse
into directories is counted, it's counted as a "failure". But we'll
ignore this from now, and avoid the unsigned overflow.
Address-Debian-Bug: #888899
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
struct fiemap_extent_list *logical_list_head = NULL;
defraged_file_count++;
+ if (defraged_file_count > total_count)
+ total_count = defraged_file_count;
if (mode_flag & DETAIL) {
if (total_count == 1 && regular_count == 1)
struct fiemap_extent_group *orig_group_tmp = NULL;
defraged_file_count++;
+ if (defraged_file_count > total_count)
+ total_count = defraged_file_count;
if (mode_flag & DETAIL) {
printf("[%u/%u]", defraged_file_count, total_count);