[CRIU] [PATCH 3/4] join-ns: skip prepare_net_ns when join net ns flag set

Dengguangxing dengguangxing at huawei.com
Sun Apr 3 23:41:38 PDT 2016


modify switch_ns error message

Signed-off-by: Deng Guangxing <dengguangxing at huawei.com>
---
 criu/namespaces.c | 2 +-
 criu/net.c        | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/criu/namespaces.c b/criu/namespaces.c
index c7a5572..5981030 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -222,7 +222,7 @@ int switch_ns(int pid, struct ns_desc *nd, int *rst)

 	nsfd = open_proc(pid, "ns/%s", nd->str);
 	if (nsfd < 0) {
-		pr_perror("Can't open ipcns file");
+		pr_perror("Can't open ns file");
 		goto err_ns;
 	}

diff --git a/criu/net.c b/criu/net.c
index faed2bd..860f1a3 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -1095,7 +1095,8 @@ int prepare_net_ns(int pid)
 	int ret = 0;
 	NetnsEntry *netns = NULL;

-	if (!(opts.empty_ns & CLONE_NEWNET)) {
+	if (!(opts.empty_ns & CLONE_NEWNET) &&
+			!(join_ns_flags & CLONE_NEWNET)) {
 		ret = restore_netns_conf(pid, &netns);
 		if (!ret)
 			ret = restore_links(pid, &netns);
-- 
2.5.0



More information about the CRIU mailing list