]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: minor optimization
authorLennart Poettering <lennart@poettering.net>
Fri, 17 Nov 2017 12:42:58 +0000 (13:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Nov 2017 10:54:08 +0000 (11:54 +0100)
no need to prepare the target path if we quite the loop anyway one step
later.

src/nspawn/nspawn-mount.c

index 3273a7cfc436e5e124439213f658418c0f62d518..bfff53054c3965846d6510b6ace09cd830a035c3 100644 (file)
@@ -1038,13 +1038,13 @@ static int mount_legacy_cgns_supported(
                         if (r == 0)
                                 break;
 
-                        target = prefix_root("/sys/fs/cgroup", tok);
-                        if (!target)
-                                return log_oom();
-
                         if (streq(controller, tok))
                                 break;
 
+                        target = prefix_root("/sys/fs/cgroup/", tok);
+                        if (!target)
+                                return log_oom();
+
                         r = symlink_idempotent(controller, target);
                         if (r == -EINVAL)
                                 return log_error_errno(r, "Invalid existing symlink for combined hierarchy: %m");