[CRIU] [PATCH 1/2] Re-create cgroups if necessary

Filipe Brandenburger filbranden at google.com
Mon Jun 23 22:01:59 PDT 2014


On Mon, Jun 23, 2014 at 9:28 PM, Tycho Andersen
<tycho.andersen at canonical.com> wrote:
> It still does modify the string, though, which means you can't pass
> read-only memory to mkdirpat, which might also be a little surprising.
> Maybe this version with a copy?

That's what Andrew meant, he kept the strcpy path -> made_path in the
patch, take a look below:

>>       strcpy(made_path, path)
>> > >   tok = made_path;
>> > >   while (tok = strchr(tok + 1, "/")) {
>> > >           char c;
>> > >           if (tok != NULL) {
>> > >                   c = *tok;
>> > >                   *tok = 0;
>> > >           }
...

Your original patch had two copies, path -> tok_path and then copying
tokens from tok_path -> made_path, Andrew's has a single copy.

Cheers,
Filipe


More information about the CRIU mailing list