]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: cleanup macros lxc_chroot
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 22 Feb 2019 20:56:55 +0000 (21:56 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 22 Feb 2019 20:56:55 +0000 (21:56 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 5385e32853b6cb40e8c1581237be2c6b5f8684a8..eba476dc285ccfa5e8a31e0b2c4353ac376e43e0 100644 (file)
@@ -1349,7 +1349,6 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
        int i, ret;
        char *p, *p2;
        char buf[LXC_LINELEN];
-       FILE *f;
        char *root = rootfs->mount;
 
        nroot = realpath(root, NULL);
@@ -1388,6 +1387,7 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
         * inherited mounts are locked and we should live with all this trash.
         */
        for (;;) {
+               __do_fclose FILE *f = NULL;
                int progress = 0;
 
                f = fopen("./proc/self/mountinfo", "r");
@@ -1421,8 +1421,6 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
                                progress++;
                }
 
-               fclose(f);
-
                if (!progress)
                        break;
        }