Commit 7ef7501c authored by Martin Mareš's avatar Martin Mareš
Browse files

Avoid warnings on unused result of fscanf()

parent ace36067
......@@ -133,9 +133,9 @@ cgroup_get_mem_limit(const char *chier, const char *cgroup)
return -1;
}
size_t nlimit = 0;
fscanf(limit, "%zu", &nlimit);
int ok = fscanf(limit, "%zu", &nlimit);
fclose(limit);
return nlimit;
return ok ? nlimit : 0;
}
static int
......@@ -198,7 +198,7 @@ cgroup_get_mem_usage(const char *chier, const char *cgroup)
return -1;
}
size_t nusage = 0;
fscanf(usage, "%zu", &nusage);
int ok = fscanf(usage, "%zu", &nusage);
fclose(usage);
return nusage;
return ok ? nusage : 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment