[git commit master 1/1] powertop: replace erroneous \n with \0; make numberic conversion more robust
Denys Vlasenko
vda.linux at googlemail.com
Thu Nov 4 22:22:40 UTC 2010
commit: http://git.busybox.net/busybox/commit/?id=dcb163aa8e7808b59aef3d3319c707e7d9ac4ce4
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
procps/powertop.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/procps/powertop.c b/procps/powertop.c
index 4c3c356..87efbe8 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -323,18 +323,16 @@ static void process_irq_counts(void)
*/
*p = '\0';
/* Deal with non-maskable interrupts -- make up fake numbers */
- nr = index_in_strings("NMI\0RES\nCAL\0TLB\0TRM\0THR\0SPU\0", buf);
- if (nr != -1) {
+ nr = index_in_strings("NMI\0RES\0CAL\0TLB\0TRM\0THR\0SPU\0", buf);
+ if (nr >= 0) {
nr += 20000;
} else {
/* bb_strtou doesn't eat leading spaces, using strtoul */
+ errno = 0;
nr = strtoul(buf, NULL, 10);
+ if (errno)
+ continue;
}
- *p = ':';
-
- if (nr == -1)
- continue;
-
p++;
/* 0: 143646045 153901007 IO-APIC-edge timer
* ^
--
1.7.1
More information about the busybox-cvs
mailing list