From e2d0c21b9a4d3cd0c114145c3ed18743abf440cd Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sat, 20 Oct 2018 11:34:35 +0200 Subject: [PATCH] conf: remove tautological check Signed-off-by: Christian Brauner --- src/lxc/conf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; -- 2.47.2