gluon-respondd: fix format string type mismatches
This commit is contained in:
parent
b69b9043f4
commit
4ee5f3590b
@ -230,8 +230,8 @@ 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;
|
int64_t user, nice, system, idle, iowait, irq, softirq;
|
||||||
if (sscanf(line, "%*s %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64" %"SCNu64,
|
if (sscanf(line, "%*s %"SCNd64" %"SCNd64" %"SCNd64" %"SCNd64" %"SCNd64" %"SCNd64" %"SCNd64,
|
||||||
&user, &nice, &system, &idle, &iowait, &irq, &softirq) != 7)
|
&user, &nice, &system, &idle, &iowait, &irq, &softirq) != 7)
|
||||||
goto invalid_stat_format;
|
goto invalid_stat_format;
|
||||||
|
|
||||||
@ -247,26 +247,26 @@ 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;
|
int64_t ctxt;
|
||||||
if (sscanf(line, "%*s %"SCNu64, &ctxt) != 1)
|
if (sscanf(line, "%*s %"SCNd64, &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;
|
int64_t total_intr;
|
||||||
if (sscanf(line, "%*s %"SCNu64, &total_intr) != 1)
|
if (sscanf(line, "%*s %"SCNd64, &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;
|
int64_t total_softirq;
|
||||||
if (sscanf(line, "%*s %"SCNu64, &total_softirq) != 1)
|
if (sscanf(line, "%*s %"SCNd64, &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;
|
int64_t processes;
|
||||||
if (sscanf(line, "%*s %"SCNu64, &processes) != 1)
|
if (sscanf(line, "%*s %"SCNd64, &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));
|
||||||
|
Loading…
Reference in New Issue
Block a user