summaryrefslogtreecommitdiff
path: root/src/print_cpu_usage.c
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2018-10-26 09:24:45 +0200
committerGitHub <noreply@github.com>2018-10-26 09:24:45 +0200
commitbe5f38e0a63a0ba96b27bc3375649c58b6df9b6d (patch)
treed2ccdbb8cebb08fe381d90952e897af297c681ab /src/print_cpu_usage.c
parent13f720ab752d61447cf7b4c06cd9a011b0d17bea (diff)
parentaa572d24b5ecf16a064f924548ed1926b7b231d6 (diff)
Merge pull request #318 from gportay/fix-invalid-cpu-placeholder
print_cpu_usage: fix invalid %cpu placeholder output
Diffstat (limited to 'src/print_cpu_usage.c')
-rw-r--r--src/print_cpu_usage.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c
index 1fccba4..411d5f4 100644
--- a/src/print_cpu_usage.c
+++ b/src/print_cpu_usage.c
@@ -151,7 +151,7 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format, const
}
#if defined(LINUX)
else if (BEGINS_WITH(walk + 1, "cpu")) {
- int number = 0;
+ int number = -1;
sscanf(walk + 1, "cpu%d", &number);
if (number < 0 || number >= cpu_count) {
fprintf(stderr, "provided CPU number '%d' above detected number of CPU %d\n", number, cpu_count);