Commit a152c843 authored by Garrison Bellack's avatar Garrison Bellack Committed by Pavel Emelyanov

Quick patch for error when writing mem.lim default

When writing the system default for memory.limit_in_bytes (which is a LLONG_MAX)
the write fails. The number is equivalent to -1 (unlimited). So during dump,
store the number -1 instead.

Change-Id: Iafccc96bf5dbade763d7addaeda24194616e4d5f
Signed-off-by: 's avatarGarrison Bellack <gbellack@google.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e606c214
...@@ -302,6 +302,7 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath) ...@@ -302,6 +302,7 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
{ {
char buf[100]; char buf[100];
FILE *f; FILE *f;
char *endptr;
f = fopen(fullpath, "r"); f = fopen(fullpath, "r");
if (!f) { if (!f) {
...@@ -324,6 +325,14 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath) ...@@ -324,6 +325,14 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
return -1; return -1;
} }
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)); property->value = xstrdup(strip(buf));
if (!property->value) if (!property->value)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment