|
@@ -62,6 +62,8 @@ int monojob_wait ( const char *string ) {
|
62
|
62
|
int rc;
|
63
|
63
|
unsigned long last_progress;
|
64
|
64
|
unsigned long elapsed;
|
|
65
|
+ unsigned long completed;
|
|
66
|
+ unsigned long total;
|
65
|
67
|
unsigned int percentage;
|
66
|
68
|
int shown_percentage = 0;
|
67
|
69
|
|
|
@@ -85,9 +87,11 @@ int monojob_wait ( const char *string ) {
|
85
|
87
|
if ( shown_percentage )
|
86
|
88
|
printf ( "\b\b\b\b \b\b\b\b" );
|
87
|
89
|
job_progress ( &monojob, &progress );
|
88
|
|
- if ( progress.total ) {
|
89
|
|
- percentage = ( ( 100 * progress.completed ) /
|
90
|
|
- progress.total );
|
|
90
|
+ /* Normalise progress figures to avoid overflow */
|
|
91
|
+ completed = ( progress.completed / 128 );
|
|
92
|
+ total = ( progress.total / 128 );
|
|
93
|
+ if ( total ) {
|
|
94
|
+ percentage = ( ( 100 * completed ) / total );
|
91
|
95
|
printf ( "%3d%%", percentage );
|
92
|
96
|
shown_percentage = 1;
|
93
|
97
|
} else {
|