]> git.proxmox.com Git - mirror_lxc.git/commitdiff
conf: remove tautological check
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 20 Oct 2018 09:34:35 +0000 (11:34 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 22 Oct 2018 14:47:44 +0000 (16:47 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index e822e90d30a01f608d72e66c218be6713df4c110..d1783aebdc2eea4f94c5e660c274160b302b00ed 100644 (file)
@@ -1494,7 +1494,8 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
  */
 static int lxc_pivot_root(const char *rootfs)
 {
-       int newroot = -1, oldroot = -1, ret = -1;
+       int oldroot;
+       int newroot = -1, ret = -1;
 
        oldroot = open("/", O_DIRECTORY | O_RDONLY);
        if (oldroot < 0) {
@@ -1564,9 +1565,9 @@ static int lxc_pivot_root(const char *rootfs)
        TRACE("pivot_root(\"%s\") successful", rootfs);
 
 on_error:
-       if (oldroot != -1)
-               close(oldroot);
-       if (newroot != -1)
+       close(oldroot);
+
+       if (newroot >= 0)
                close(newroot);
 
        return ret;