[CRIU] [PATCH 1/2] Quick patch for error when writing mem.lim default
Ying Han
yinghan at google.com
Fri Aug 15 09:54:54 PDT 2014
Ping?
On Wed, Aug 13, 2014 at 11:59 AM, <gbellack at google.com> wrote:
> From: Garrison Bellack <gbellack at google.com>
>
> 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: Garrison Bellack <gbellack at google.com>
> ---
> cgroup.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/cgroup.c b/cgroup.c
> index 7ac2dd8..f8dbbde 100644
> --- a/cgroup.c
> +++ b/cgroup.c
> @@ -288,6 +288,7 @@ static int read_cgroup_prop(struct cgroup_prop
> *property, const char *fpath)
> {
> char pbuf[PATH_MAX], buf[100];
> FILE *f;
> + char *endptr;
>
> if (snprintf(pbuf, PATH_MAX, "%s/%s", fpath, property->name) >=
> PATH_MAX) {
> pr_err("snprintf output was truncated");
> @@ -315,6 +316,14 @@ static int read_cgroup_prop(struct cgroup_prop
> *property, const char *fpath)
> 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(buf);
> if (!property->value)
> return -1;
> --
> 2.1.0.rc2.206.gedb03e5
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20140815/2cf964ae/attachment.html>
More information about the CRIU
mailing list