Skip to content
Snippets Groups Projects
Commit dde70869 authored by lemoer's avatar lemoer Committed by Andreas Ziegler
Browse files

gluon-respondd: use %SCNu64 instead of %llu for uint64_t

parent 6ac7e97f
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <inttypes.h>
#include <sys/vfs.h> #include <sys/vfs.h>
...@@ -228,7 +229,7 @@ static struct json_object * get_stat(void) { ...@@ -228,7 +229,7 @@ static struct json_object * get_stat(void) {
if (!strcmp(label, "cpu")) { if (!strcmp(label, "cpu")) {
unsigned long long user, nice, system, idle, iowait, irq, softirq; unsigned long long user, nice, system, idle, iowait, irq, softirq;
if(sscanf(line, "%*s %llu %llu %llu %llu %llu %llu %llu", if(sscanf(line, "%*s %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64,
&user, &nice, &system, &idle, &iowait, &irq, &softirq) != 7) &user, &nice, &system, &idle, &iowait, &irq, &softirq) != 7)
goto invalid_stat_format; goto invalid_stat_format;
...@@ -245,25 +246,25 @@ static struct json_object * get_stat(void) { ...@@ -245,25 +246,25 @@ static struct json_object * get_stat(void) {
json_object_object_add(stat, "cpu", cpu); json_object_object_add(stat, "cpu", cpu);
} else if (!strcmp(label, "ctxt")) { } else if (!strcmp(label, "ctxt")) {
unsigned long long ctxt; unsigned long long ctxt;
if(sscanf(line, "%*s %llu", &ctxt) != 1) if(sscanf(line, "%*s %"SCNu64, &ctxt) != 1)
goto invalid_stat_format; goto invalid_stat_format;
json_object_object_add(stat, "ctxt", json_object_new_int64(ctxt)); json_object_object_add(stat, "ctxt", json_object_new_int64(ctxt));
} else if (!strcmp(label, "intr")) { } else if (!strcmp(label, "intr")) {
unsigned long long total_intr; unsigned long long total_intr;
if(sscanf(line, "%*s %llu", &total_intr) != 1) if(sscanf(line, "%*s %"SCNu64, &total_intr) != 1)
goto invalid_stat_format; goto invalid_stat_format;
json_object_object_add(stat, "intr", json_object_new_int64(total_intr)); json_object_object_add(stat, "intr", json_object_new_int64(total_intr));
} else if (!strcmp(label, "softirq")) { } else if (!strcmp(label, "softirq")) {
unsigned long long total_softirq; unsigned long long total_softirq;
if(sscanf(line, "%*s %llu", &total_softirq) != 1) if(sscanf(line, "%*s %"SCNu64, &total_softirq) != 1)
goto invalid_stat_format; goto invalid_stat_format;
json_object_object_add(stat, "softirq", json_object_new_int64(total_softirq)); json_object_object_add(stat, "softirq", json_object_new_int64(total_softirq));
} else if (!strcmp(label, "processes")) { } else if (!strcmp(label, "processes")) {
unsigned long long processes; unsigned long long processes;
if(sscanf(line, "%*s %llu", &processes) != 1) if(sscanf(line, "%*s %"SCNu64, &processes) != 1)
goto invalid_stat_format; goto invalid_stat_format;
json_object_object_add(stat, "processes", json_object_new_int64(processes)); json_object_object_add(stat, "processes", json_object_new_int64(processes));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment