[CRIU] [PATCH 2/3] cg: allow properties that aren't integers

Tycho Andersen tycho.andersen at canonical.com
Fri Aug 22 07:22:31 PDT 2014


In particular, cpuset.cpus and cpuset.mems can both be "lists" (strings), as
well as hex integers. We don't use the result of this parse, so it is fine to delete it.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 cgroup.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/cgroup.c b/cgroup.c
index c5ae154..940e6eb 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -295,12 +295,12 @@ static inline char *strip(char *str)
 }
 
 /*
- * Currently this function only supports properties that have 1 value, under 100
- * chars
+ * Currently this function only supports properties that have a string value
+ * under 1024 chars.
  */
 static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
 {
-	char buf[100];
+	char buf[1024];
 	FILE *f;
 	char *endptr;
 
@@ -328,11 +328,6 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
 	if (strtoll(buf, &endptr, 10) == LLONG_MAX)
 		strcpy(buf, "-1");
 
-	if (strcmp(endptr, "\n")) {
-		pr_perror("Failed parsing %s, with strtoll\n", buf);
-		return -1;
-	}
-
 	property->value = xstrdup(strip(buf));
 	if (!property->value)
 		return -1;
-- 
1.9.1



More information about the CRIU mailing list