From b8d164cd2412edc65ba47c573f2abcc254dbbbc9 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 8 Aug 2000 03:17:04 +0000 Subject: [PATCH] ChangeLog, unix.c: unix.c (calc_percent): Make sure that we don't take a floating exception if the max value is zero. (should normally never happen, but...) --- e2fsck/ChangeLog | 6 ++++++ e2fsck/unix.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index af145f9..2c4efaa 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2000-08-07 + + * unix.c (calc_percent): Make sure that we don't take a floating + exception if the max value is zero. (should normally + never happen, but...) + 2000-07-13 * Release of E2fsprogs 1.19 diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 9503471..71a321c 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -305,7 +305,7 @@ static float calc_percent(struct percent_tbl *tbl, int pass, int curr, if (pass <= 0) return 0.0; - if (pass > tbl->max_pass) + if (pass > tbl->max_pass || max == 0) return 100.0; percent = ((float) curr) / ((float) max); return ((percent * (tbl->table[pass] - tbl->table[pass-1])) -- 1.8.3.1