From: Christian Brauner Date: Sat, 20 Oct 2018 09:34:35 +0000 (+0200) Subject: conf: remove tautological check X-Git-Tag: lxc-3.1.0~29^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2d0c21b9a4d3cd0c114145c3ed18743abf440cd;p=thirdparty%2Flxc.git conf: remove tautological check Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index e822e90d3..d1783aebd 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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;