]> git.proxmox.com Git - mirror_lxc.git/commitdiff
conf: make tmp_umount_proc bool
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 28 May 2018 22:54:16 +0000 (00:54 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 28 May 2018 22:54:16 +0000 (00:54 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c
src/lxc/conf.h

index 2c6efe71ff81fd1b5094fae9278ba2cc34d04899..dcbee2868dcc782b7b427139e7e7e1459fb1289b 100644 (file)
@@ -2676,7 +2676,7 @@ struct lxc_conf *lxc_conf_init(void)
        lxc_list_init(&new->state_clients);
        new->lsm_aa_profile = NULL;
        new->lsm_se_context = NULL;
-       new->tmp_umount_proc = 0;
+       new->tmp_umount_proc = false;
 
        /* if running in a new user namespace, init and COMMAND
         * default to running as UID/GID 0 when using lxc-execute */
@@ -3158,7 +3158,7 @@ int lxc_create_tmp_proc_mount(struct lxc_conf *conf)
                if (conf->rootfs.path)
                        return -1;
        } else if (mounted == 1) {
-               conf->tmp_umount_proc = 1;
+               conf->tmp_umount_proc = true;
        }
 
        return 0;
@@ -3166,11 +3166,11 @@ int lxc_create_tmp_proc_mount(struct lxc_conf *conf)
 
 void tmp_proc_unmount(struct lxc_conf *lxc_conf)
 {
-       if (lxc_conf->tmp_umount_proc != 1)
+       if (!lxc_conf->tmp_umount_proc)
                return;
 
-       umount("/proc");
-       lxc_conf->tmp_umount_proc = 0;
+       (void)umount2("/proc", MNT_DETACH);
+       lxc_conf->tmp_umount_proc = false;
 }
 
 /* Walk /proc/mounts and change any shared entries to slave. */
index e28f54b85c1fa9bca09125501490e5a6915d8d2c..1565cdef95a088baf4ec4fd2253c056516a36560 100644 (file)
@@ -271,7 +271,7 @@ struct lxc_conf {
        char *lsm_aa_profile;
        unsigned int lsm_aa_allow_incomplete;
        char *lsm_se_context;
-       int tmp_umount_proc;
+       bool tmp_umount_proc;
        char *seccomp;  /* filename with the seccomp rules */
 #if HAVE_SCMP_FILTER_CTX
        scmp_filter_ctx seccomp_ctx;