[CRIU] [PATCH 1/9] criu/mount.c: fix printing errno

Kir Kolyshkin kir at openvz.org
Mon Nov 7 13:37:45 PST 2016


An errno from setns might be lost after close()s, so change the order.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 criu/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index 8638253..eea1a8a 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2772,9 +2772,9 @@ int depopulate_roots_yard(int mntns_fd, bool clean_remaps)
 		return -1;
 	}
 	if (setns(mntns_fd, CLONE_NEWNS) < 0) {
+		pr_perror("`- Can't switch");
 		close(old_ns);
 		close(old_cwd);
-		pr_perror("`- Can't switch");
 		return -1;
 	}
 
-- 
2.7.4



More information about the CRIU mailing list