[CRIU] [PATCH] namespaces: user open_proc() in switch_ns()

Andrey Vagin avagin at openvz.org
Tue Oct 28 13:31:23 PDT 2014


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 namespaces.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/namespaces.c b/namespaces.c
index 87849fa..23ee4ed 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -66,8 +66,7 @@ int switch_ns(int pid, struct ns_desc *nd, int *rst)
 	int nsfd;
 	int ret = -1;
 
-	snprintf(buf, sizeof(buf), "/proc/%d/ns/%s", pid, nd->str);
-	nsfd = open(buf, O_RDONLY);
+	nsfd = open_proc(pid, "ns/%s", nd->str);
 	if (nsfd < 0) {
 		pr_perror("Can't open ipcns file");
 		goto err_ns;
-- 
1.9.3



More information about the CRIU mailing list