From edba04c9786b32f0628e08b719685447a40f1560 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Thu, 8 Jun 2017 15:05:28 +0200 Subject: [PATCH] Fix batch mode for tools progress function. --- src/integritysetup.c | 3 +-- src/utils_tools.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/integritysetup.c b/src/integritysetup.c index ded1ae10..cba658ba 100644 --- a/src/integritysetup.c +++ b/src/integritysetup.c @@ -137,8 +137,7 @@ static int wipe_callback(uint64_t size, uint64_t offset, void *usrptr) static struct timeval start_time = {}, end_time = {}; int r = 0; - if (!opt_batch_mode) - tools_time_progress(size, offset, &start_time, &end_time); + tools_time_progress(size, offset, &start_time, &end_time); check_signal(&r); if (r) { diff --git a/src/utils_tools.c b/src/utils_tools.c index 08f92818..fea336a7 100644 --- a/src/utils_tools.c +++ b/src/utils_tools.c @@ -351,6 +351,9 @@ void tools_time_progress(uint64_t device_size, uint64_t bytes, double tdiff, mib; int final = (bytes == device_size); + if (opt_batch_mode) + return; + gettimeofday(&now_time, NULL); if (start_time->tv_sec == 0 && start_time->tv_usec == 0) { *start_time = now_time;