]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: fix coding style
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 27 Jan 2021 15:10:24 +0000 (16:10 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 27 Jan 2021 15:16:42 +0000 (16:16 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index f04312abc8462dfe4461c9446ebb38240e0baeab..499b1c96dfe6c3a0ee7995754780aeec2a4ff50b 100644 (file)
@@ -639,8 +639,10 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
                { LXC_AUTO_SYS_MASK,  LXC_AUTO_SYS_MIXED,  NULL,                                             "%r/sys/devices/virtual/net", NULL,    MS_REMOUNT|MS_BIND|MS_NOSUID|MS_NODEV|MS_NOEXEC, NULL, false },
                { 0,                  0,                   NULL,                                             NULL,                         NULL,    0,                                               NULL, false }
        };
+        struct lxc_rootfs *rootfs = &conf->rootfs;
+        bool has_cap_net_admin;
 
-        bool has_cap_net_admin = lxc_wants_cap(CAP_NET_ADMIN, conf);
+        has_cap_net_admin = lxc_wants_cap(CAP_NET_ADMIN, conf);
         for (i = 0; default_mounts[i].match_mask; i++) {
                __do_free char *destination = NULL, *source = NULL;
                int saved_errno;
@@ -650,7 +652,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
 
                if (default_mounts[i].source) {
                        /* will act like strdup if %r is not present */
-                       source = lxc_string_replace("%r", conf->rootfs.path ? conf->rootfs.mount : "", default_mounts[i].source);
+                       source = lxc_string_replace("%r", rootfs->path ? rootfs->mount : "", default_mounts[i].source);
                        if (!source)
                                return -1;
                }
@@ -664,7 +666,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
                }
 
                /* will act like strdup if %r is not present */
-               destination = lxc_string_replace("%r", conf->rootfs.path ? conf->rootfs.mount : "", default_mounts[i].destination);
+               destination = lxc_string_replace("%r", rootfs->path ? rootfs->mount : "", default_mounts[i].destination);
                if (!destination)
                        return -1;
 
@@ -672,7 +674,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
                                                    default_mounts[i].flags);
                r = safe_mount(source, destination, default_mounts[i].fstype,
                               mflags, default_mounts[i].options,
-                              conf->rootfs.path ? conf->rootfs.mount : NULL);
+                              rootfs->path ? rootfs->mount : NULL);
                saved_errno = errno;
                if (r < 0 && errno == ENOENT) {
                        INFO("Mount source or target for \"%s\" on \"%s\" does not exist. Skipping", source, destination);
@@ -720,7 +722,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
 
                if (!handler->cgroup_ops->mount(handler->cgroup_ops,
                                                handler,
-                                               conf->rootfs.path ? conf->rootfs.mount : "",
+                                               rootfs->path ? rootfs->mount : "",
                                                cg_flags))
                        return log_error_errno(-1, errno, "Failed to mount \"/sys/fs/cgroup\"");
        }