Skip to content
Snippets Groups Projects
Commit 7ef7501c authored by Martin Mareš's avatar Martin Mareš
Browse files

Avoid warnings on unused result of fscanf()

parent ace36067
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment