[CRIU] [PATCH 1/8] cgroup: drop useless name variable in collect_cgroups

Dmitry Safonov dsafonov at virtuozzo.com
Fri Jul 15 12:28:40 PDT 2016


It looks like, it's completely not needed here.

criu/cgroup.c:582:4: warning: Value stored to 'name' is never read
                        name = cc->name + 5;
                        ^      ~~~~~~~~~~~~

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cgroup.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index 72d80c40b3e7..eb1f6bbd7005 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -547,7 +547,7 @@ static int collect_cgroups(struct list_head *ctls)
 
 	list_for_each_entry(cc, ctls, l) {
 		char path[PATH_MAX], mopts[1024];
-		char *name, prefix[] = ".criu.cgmounts.XXXXXX";
+		char prefix[] = ".criu.cgmounts.XXXXXX";
 		struct cg_controller *cg;
 
 		current_controller = NULL;
@@ -578,13 +578,10 @@ static int collect_cgroups(struct list_head *ctls)
 		if (!opts.manage_cgroups)
 			continue;
 
-		if (strstartswith(cc->name, "name=")) {
-			name = cc->name + 5;
+		if (strstartswith(cc->name, "name="))
 			snprintf(mopts, sizeof(mopts), "none,%s", cc->name);
-		} else {
-			name = cc->name;
-			snprintf(mopts, sizeof(mopts), "%s", name);
-		}
+		else
+			snprintf(mopts, sizeof(mopts), "%s", cc->name);
 
 		if (mkdtemp(prefix) == NULL) {
 			pr_perror("can't make dir for cg mounts");
-- 
2.9.0



More information about the CRIU mailing list