printf-utils: Fix division by zero if total is zero
This commit is contained in:
1 parent
99608d2b3f
commit
79a171e823
1 file changed
+1
-1
+1
-1
@@ -39,7 +39,7 @@ void printf_progressbar(unsigned long long part, unsigned long long total) {
|
|||||||
int tmp, cols = 80;
|
int tmp, cols = 80;
|
||||||
|
|
||||||
/* percentage calculation */
|
/* percentage calculation */
|
||||||
pc = (int)(part*100/total);
|
pc = total==0?100:(int)(part*100/total);
|
||||||
(pc<0)?pc=0:(pc>100)?pc=100:0;
|
(pc<0)?pc=0:(pc>100)?pc=100:0;
|
||||||
|
|
||||||
PRINTF_BACK();
|
PRINTF_BACK();
|
||||||
|
|||||||
Reference in new issue
Block a user