[CRIU] Re: [PATCH v2 2/3] namespaces: parametrized namespace option
introduced
Pavel Emelyanov
xemul at parallels.com
Mon Jan 30 12:54:43 EST 2012
> +static int parse_ns_string(const char *ptr, unsigned int *flags)
> +{
> + const char *end = ptr + strlen(ptr);
> +
> + do {
> + if (strlen(ptr) < 3)
This strlen is excessive. The strncmp will do the thing.
> + goto bad_ns;
> + if (ptr[3] != ',' && ptr[3] != '\0')
> + goto bad_ns;
> + if (!strncmp(ptr, "uts", 3))
> + opts.namespaces_flags |= CLONE_NEWUTS;
> + else
> + goto bad_ns;
> + ptr += 4;
> + } while (ptr < end);
> + return 0;
> +
> +bad_ns:
> + pr_err("Unknown namespace '%s'\n", ptr);
> + return -1;
> +}
More information about the CRIU
mailing list