From 26dc9574da19c606bbd551afc2fbc2b63b2a9d6c Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Fri, 13 May 2011 13:43:23 -0400 Subject: [PATCH] irqbalance: fix where there are no IRQ 0 and it seg faults. --- root_image/irqbalance/procinterrupts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; -- 2.39.5