]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: tweak parse_lxc_mntopts()
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 Mar 2021 11:15:01 +0000 (12:15 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 21 Apr 2021 08:07:35 +0000 (10:07 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index baacf928940459d1d772800e490d893b63dac1b3..02aba7ee190dc04b3b3efc648383697a5c8dad32 100644 (file)
@@ -2123,9 +2123,8 @@ const char *lxc_mount_options_info[LXC_MOUNT_MAX] = {
 /* Remove "optional", "create=dir", and "create=file" from mntopt */
 int parse_lxc_mntopts(struct lxc_mount_options *opts, char *mnt_opts)
 {
-       __do_close int fd_userns = -EBADF;
-
        for (size_t i = LXC_MOUNT_CREATE_DIR; i < LXC_MOUNT_MAX; i++) {
+               __do_close int fd_userns = -EBADF;
                const char *opt_name = lxc_mount_options_info[i];
                size_t len;
                char *idmap_path, *p, *p2;
@@ -2159,7 +2158,6 @@ int parse_lxc_mntopts(struct lxc_mount_options *opts, char *mnt_opts)
                        if (is_empty_string(opts->userns_path))
                                return syserror_set(-EINVAL, "Missing idmap path for \"idmap=<path>\" LXC specific mount option");
 
-                       close_prot_errno_disarm(fd_userns);
                        fd_userns = open(opts->userns_path, O_RDONLY | O_NOCTTY | O_CLOEXEC);
                        if (fd_userns < 0)
                                return syserror("Failed to open user namespace");