The conditions now == start or pos == start_pos are checked
at the beginning of the function definition to ensure that avg
is non zero.
Also an appropriate print statement is added to indicate
the print status.
Signed-off-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri May 16 07:10:57 UTC 2025 on atb-devel-224
char hpos[22], htotal[22], havg[22];
char *status, *filename;
int len;
- if (now - start) {
- avg = 1.0 * (pos - start_pos) / (now - start);
+
+ if (now == start || pos == start_pos) {
+ fprintf(stderr, "\r[%s] No progress yet", name);
+ return;
}
+ avg = 1.0 * (pos - start_pos) / (now - start);
eta = (total - pos) / avg;
if (total) {
prcnt = 100.0 * pos / total;