[CRIU] [PATCH 1/3] crtools: Make new_cg_root_add setup global root too

Pavel Emelyanov xemul at parallels.com
Fri Aug 22 05:10:27 PDT 2014


This is to make it convenient for service to setup the same thing.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---

diff --git a/cgroup.c b/cgroup.c
index 3c7e48a..385f57b 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -1285,6 +1285,11 @@ int new_cg_root_add(char *controller, char *newroot)
 {
 	struct cg_root_opt *o;
 
+	if (!controller) {
+		opts.new_global_cg_root = newroot;
+		return 0;
+	}
+
 	o = xmalloc(sizeof(*o));
 	if (!o)
 		return -1;
diff --git a/crtools.c b/crtools.c
index 27164c4..afdc59b 100644
--- a/crtools.c
+++ b/crtools.c
@@ -364,17 +364,20 @@ int main(int argc, char *argv[])
 			break;
 		case 61:
 			{
-				char *aux;
+				char *path, *ctl;
 
-				aux = strchr(optarg, ':');
-				if (!aux) {
-					opts.new_global_cg_root = optarg;
+				path = strchr(optarg, ':');
+				if (path) {
+					*path = '\0';
+					path++;
+					ctl = optarg;
 				} else {
-					*aux = '\0';
-					if (new_cg_root_add(optarg, aux + 1))
-						return -1;
+					path = optarg;
+					ctl = NULL;
 				}
 
+				if (new_cg_root_add(ctl, path))
+					return -1;
 			}
 			break;
 		case 'M':



More information about the CRIU mailing list