Commit 7947ea71 authored by Pavel Emelyanov's avatar Pavel Emelyanov

crtools: Make new_cg_root_add setup global root too

This is to make it convenient for service to setup the same thing.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
parent ad4d9124
...@@ -1338,6 +1338,11 @@ int new_cg_root_add(char *controller, char *newroot) ...@@ -1338,6 +1338,11 @@ int new_cg_root_add(char *controller, char *newroot)
{ {
struct cg_root_opt *o; struct cg_root_opt *o;
if (!controller) {
opts.new_global_cg_root = newroot;
return 0;
}
o = xmalloc(sizeof(*o)); o = xmalloc(sizeof(*o));
if (!o) if (!o)
return -1; return -1;
......
...@@ -364,17 +364,20 @@ int main(int argc, char *argv[]) ...@@ -364,17 +364,20 @@ int main(int argc, char *argv[])
break; break;
case 61: case 61:
{ {
char *aux; char *path, *ctl;
aux = strchr(optarg, ':'); path = strchr(optarg, ':');
if (!aux) { if (path) {
opts.new_global_cg_root = optarg; *path = '\0';
path++;
ctl = optarg;
} else { } else {
*aux = '\0'; path = optarg;
if (new_cg_root_add(optarg, aux + 1)) ctl = NULL;
return -1;
} }
if (new_cg_root_add(ctl, path))
return -1;
} }
break; break;
case 'M': case 'M':
......
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