]> xenbits.xensource.com Git - xentesttools/bootstrap.git/commitdiff
irqbalance: fix where there are no IRQ 0 and it seg faults.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 13 May 2011 17:43:23 +0000 (13:43 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 13 May 2011 17:43:23 +0000 (13:43 -0400)
root_image/irqbalance/procinterrupts.c

index e336efe52c7ecfc19ce87cbc5ae240b62f916160..cb7d2a3dfba687c3f51791d2daf3a31ab793c3ff 100644 (file)
@@ -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;