]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: mount_entry_on_generic()
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 1 Aug 2017 20:18:38 +0000 (22:18 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 15 Aug 2017 20:36:08 +0000 (16:36 -0400)
non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 02a1c10f549235fd7afcba2571692c7eb694e906..88fbf34696b6a6fa25fbd2cde6c30ae58de45587 100644 (file)
@@ -1831,30 +1831,36 @@ static int mount_entry_create_dir_file(const struct mntent *mntent,
 /* rootfs, lxc_name, and lxc_path can be NULL when the container is created
  * without a rootfs. */
 static inline int mount_entry_on_generic(struct mntent *mntent,
-                 const char* path, const struct lxc_rootfs *rootfs,
-                const char *lxc_name, const char *lxc_path)
+                                        const char *path,
+                                        const struct lxc_rootfs *rootfs,
+                                        const char *lxc_name,
+                                        const char *lxc_path)
 {
+       int ret;
        unsigned long mntflags;
        char *mntdata;
-       int ret;
-       bool optional = hasmntopt(mntent, "optional") != NULL;
-       bool dev = hasmntopt(mntent, "dev") != NULL;
-
+       bool dev, optional;
        char *rootfs_path = NULL;
+
+       optional = hasmntopt(mntent, "optional") != NULL;
+       dev = hasmntopt(mntent, "dev") != NULL;
+
        if (rootfs && rootfs->path)
                rootfs_path = rootfs->mount;
 
-       ret = mount_entry_create_dir_file(mntent, path, rootfs, lxc_name, lxc_path);
-
-       if (ret < 0)
-               return optional ? 0 : -1;
+       ret = mount_entry_create_dir_file(mntent, path, rootfs, lxc_name,
+                                         lxc_path);
+       if (ret < 0) {
+               if (optional)
+                       return 0;
 
+               return -1;
+       }
        cull_mntent_opt(mntent);
 
-       if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) {
-               free(mntdata);
+       ret = parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata);
+       if (ret < 0)
                return -1;
-       }
 
        ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type, mntflags,
                          mntdata, optional, dev, rootfs_path);