[CRIU] [PATCH 1/2] Re-create cgroups if necessary
Tycho Andersen
tycho.andersen at canonical.com
Mon Jun 23 19:29:27 PDT 2014
On Mon, Jun 23, 2014 at 10:53:48PM +0400, Andrew Vagin wrote:
>
> Look at my version. It doesn't copy a path in another place.
The copy is sort of unfortunate, strtok writes a null byte to the
string it is tokenizing, which seems impolite to do as callers won't
expect it, even though it might not break anything. I used it because
I prefer using library functions to rolling my own, but I'm happy to
switch it if the copy is a big issue.
Tycho
> tok = path;
> while (tok = strchr(tok + 1, "/")) {
> char c;
> if (tok != NULL) {
> c = *tok;
> *tok = 0;
> }
>
> if (mkdirat(fd, path, 0755) < 0 && errno != EEXIST) {
> pr_perror("couldn't mkdirpat directory\n");
> return -1;
> }
>
> if (tok == NULL)
> break;
> else
> *tok = c;
> }
>
> Thanks.
More information about the CRIU
mailing list