1 diff -up libcgroup-0.41/src/api.c.fread libcgroup-0.41/src/api.c
2 --- libcgroup-0.41/src/api.c.fread 2014-01-13 21:01:32.067067615 +0100
3 +++ libcgroup-0.41/src/api.c 2014-01-13 21:01:32.070067594 +0100
4 @@ -2232,29 +2232,29 @@ static int cg_rd_ctrl_file(const char *s
5 const char *file, char **value)
7 char path[FILENAME_MAX];
8 - FILE *ctrl_file = NULL;
13 if (!cg_build_path_locked(cgroup, path, subsys))
16 strncat(path, file, sizeof(path) - strlen(path));
17 - ctrl_file = fopen(path, "re");
19 + ctrl_file = open(path, O_RDONLY | O_CLOEXEC);
21 return ECGROUPVALUENOTEXIST;
23 *value = calloc(CG_VALUE_MAX, 1);
32 - * using %as crashes when we try to read from files like
33 + * using %as or fread crashes when we try to read from files like
36 - ret = fread(*value, 1, CG_VALUE_MAX-1, ctrl_file);
37 + ret = read(ctrl_file, *value, CG_VALUE_MAX-1);
41 @@ -2264,7 +2264,7 @@ static int cg_rd_ctrl_file(const char *s
42 (*value)[ret-1] = '\0';