[CRIU] [PATCH v2 1/4] ns: Override fake pid in rst_add_ns_id()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Mar 1 02:14:04 PST 2017


During reading of ns file, we add namespaces with fake pid -1.
Allow to override it later with real pid of a process.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/namespaces.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/namespaces.c b/criu/namespaces.c
index 992cd17e0..b1e65df43 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -320,7 +320,7 @@ int rst_add_ns_id(unsigned int id, struct pstree_item *i, struct ns_desc *nd)
 
 	nsid = lookup_ns_by_id(id, nd);
 	if (nsid) {
-		if (pid_rst_prio(pid, nsid->ns_pid))
+		if (nsid->ns_pid == -1 || pid_rst_prio(pid, nsid->ns_pid))
 			nsid->ns_pid = pid;
 		return 0;
 	}



More information about the CRIU mailing list