From: Konrad Rzeszutek Wilk Date: Fri, 13 May 2011 17:43:23 +0000 (-0400) Subject: irqbalance: fix where there are no IRQ 0 and it seg faults. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=26dc9574da19c606bbd551afc2fbc2b63b2a9d6c;p=xentesttools%2Fbootstrap.git irqbalance: fix where there are no IRQ 0 and it seg faults. --- diff --git a/root_image/irqbalance/procinterrupts.c b/root_image/irqbalance/procinterrupts.c index e336efe..cb7d2a3 100644 --- a/root_image/irqbalance/procinterrupts.c +++ b/root_image/irqbalance/procinterrupts.c @@ -50,7 +50,7 @@ void parse_proc_interrupts(void) int cpunr; int number; uint64_t count; - char *c, *c2; + char *c, *c2, *err; if (getline(&line, &size, file)==0) break; @@ -64,7 +64,11 @@ void parse_proc_interrupts(void) continue; *c = 0; c++; - number = strtoul(line, NULL, 10); + number = strtoul(line, &err, 10); + /* Man page says that if that happens and number == 0, then it + * failed to parse. */ + if (err == line && number == 0) + continue; count = 0; cpunr = 0;