Message ID | 20180802043507.28734-4-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Refactoring progress bar code | expand |
diff --git a/src/progress.c b/src/progress.c index 8aef486..648596d 100644 --- a/src/progress.c +++ b/src/progress.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include <assert.h> #include "progress.h" @@ -33,6 +34,8 @@ static void progress_bar(unsigned int percent) { unsigned int i, progress; + assert(percent <= 100); + progress = (percent * PROGRESS_CHARS) / 101; fprintf(stderr, "\r[");
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- src/progress.c | 3 +++ 1 file changed, 3 insertions(+)