diff --git a/ChangeLog b/ChangeLog index 4bcd6fbb..ed8230b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ * Allow more than 9 CPUs for CPU stats (bug 2155500) * Fix broken $execbar (bug 2133709) * Don't put unit with hddtemp values for consistency (bug 2133107) + * Limit $battery_percent to 100 (bug 2145006) 2008-12-06 * Switching from svn to git repository. The repo can be viewed from diff --git a/src/linux.c b/src/linux.c index a6e53220..a48e9831 100644 --- a/src/linux.c +++ b/src/linux.c @@ -1940,6 +1940,7 @@ int get_battery_perct(const char *bat) /* compute the battery percentage */ last_battery_perct[idx] = (int) (((float) remaining_capacity / acpi_design_capacity[idx]) * 100); + if (last_battery_perct[idx] > 100) last_battery_perct[idx] = 100; return last_battery_perct[idx]; }