[CRIU] [PATCH] mount: stop doing anything if populate_mnt_ns() failed

Andrey Vagin avagin at openvz.org
Tue Dec 8 08:02:42 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 mount.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index ec88553..eb80f80 100644
--- a/mount.c
+++ b/mount.c
@@ -3161,6 +3161,8 @@ int prepare_mnt_ns(void)
 	ret = populate_mnt_ns();
 	if (!ret && opts.root)
 		ret = cr_pivot_root(NULL);
+	if (ret)
+		return -1;
 
 	rst = open_proc(PROC_SELF, "ns/mnt");
 	if (rst < 0)
@@ -3207,7 +3209,7 @@ int prepare_mnt_ns(void)
 
 	return ret;
 err:
-	if (rst)
+	if (rst >= 0)
 		restore_ns(rst, &mnt_ns_desc);
 	return -1;
 }
-- 
2.4.3



More information about the CRIU mailing list