From cd14f1f2f557b4fb810cac6e61aa2ab50041f071 Mon Sep 17 00:00:00 2001 From: rliebscher Date: Fri, 14 Nov 2014 10:22:52 +0000 Subject: [PATCH] bug #40142 Floating point exception on Ubuntu 10.04 * avr.c: avoid division by zero in report_progress(), eg. when writing an empty eeprom file were total becomes 0 git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1340 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 6 ++++++ avr.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 62f6f027..21b6d0a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-11-14 Rene Liebscher + + bug #40142 Floating point exception on Ubuntu 10.04 + * avr.c: avoid division by zero in report_progress(), eg. when + writing an empty eeprom file were total becomes 0 + 2014-11-13 Rene Liebscher patch #8504 buspirate: Also support "cpufreq" extended parameter diff --git a/avr.c b/avr.c index 8a777845..8df586a3 100644 --- a/avr.c +++ b/avr.c @@ -1214,7 +1214,7 @@ void report_progress (int completed, int total, char *hdr) { static int last = 0; static double start_time; - int percent = (completed * 100) / total; + int percent = (total > 0) ? ((completed * 100) / total) : 100; struct timeval tv; double t;