I've tested the patch by running the tests available in the tests
directory.
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@185
4f4bb910-9a46-0410-90c8-
c897d4f1cd53
char *value;
char path[FILENAME_MAX];
FILE *ctrl_file;
+ int ret;
if (!cg_build_path_locked(cgroup, path, subsys))
return NULL;
* using %as crashes when we try to read from files like
* memory.stat
*/
- fscanf(ctrl_file, "%s", value);
+ ret = fscanf(ctrl_file, "%s", value);
+ if (ret == 0 || ret == EOF) {
+ free(value);
+ value = NULL;
+ }
fclose(ctrl_file);