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
This commit is contained in:
rliebscher 2014-11-14 10:22:52 +00:00
parent e88899e0a2
commit cd14f1f2f5
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-11-14 Rene Liebscher <R.Liebscher@gmx.de>
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 <R.Liebscher@gmx.de> 2014-11-13 Rene Liebscher <R.Liebscher@gmx.de>
patch #8504 buspirate: Also support "cpufreq" extended parameter patch #8504 buspirate: Also support "cpufreq" extended parameter

2
avr.c
View File

@ -1214,7 +1214,7 @@ void report_progress (int completed, int total, char *hdr)
{ {
static int last = 0; static int last = 0;
static double start_time; static double start_time;
int percent = (completed * 100) / total; int percent = (total > 0) ? ((completed * 100) / total) : 100;
struct timeval tv; struct timeval tv;
double t; double t;