diff -up libcgroup-0.41/src/api.c.fread libcgroup-0.41/src/api.c
--- libcgroup-0.41/src/api.c.fread	2014-01-13 21:01:32.067067615 +0100
+++ libcgroup-0.41/src/api.c	2014-01-13 21:01:32.070067594 +0100
@@ -2232,29 +2232,29 @@ static int cg_rd_ctrl_file(const char *s
 					const char *file, char **value)
 {
 	char path[FILENAME_MAX];
-	FILE *ctrl_file = NULL;
-	int ret;
+	int ctrl_file = -1;
+	ssize_t ret;
 
 	if (!cg_build_path_locked(cgroup, path, subsys))
 		return ECGFAIL;
 
 	strncat(path, file, sizeof(path) - strlen(path));
-	ctrl_file = fopen(path, "re");
-	if (!ctrl_file)
+	ctrl_file = open(path, O_RDONLY | O_CLOEXEC);
+	if (ctrl_file < 0)
 		return ECGROUPVALUENOTEXIST;
 
 	*value = calloc(CG_VALUE_MAX, 1);
 	if (!*value) {
-		fclose(ctrl_file);
+		close(ctrl_file);
 		last_errno = errno;
 		return ECGOTHER;
 	}
 
 	/*
-	 * using %as crashes when we try to read from files like
+	 * using %as or fread crashes when we try to read from files like
 	 * memory.stat
 	 */
-	ret = fread(*value, 1, CG_VALUE_MAX-1, ctrl_file);
+	ret = read(ctrl_file, *value, CG_VALUE_MAX-1);
 	if (ret < 0) {
 		free(*value);
 		*value = NULL;
@@ -2264,7 +2264,7 @@ static int cg_rd_ctrl_file(const char *s
 			(*value)[ret-1] = '\0';
 	}
 
-	fclose(ctrl_file);
+	close(ctrl_file);
 
 	return 0;
 }
