[CRIU] [PATCH 3/3] ns: Don't do manual lookup_ns_by_id

Pavel Emelyanov xemul at parallels.com
Fri Nov 7 08:26:04 PST 2014


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 namespaces.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/namespaces.c b/namespaces.c
index b861d5f..85e447b 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -148,12 +148,11 @@ int rst_add_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd)
 {
 	struct ns_id *nsid;
 
-	for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
-		if (nsid->id == id) {
-			if (pid_rst_prio(pid, nsid->pid))
-				nsid->pid = pid;
-			return 0;
-		}
+	nsid = lookup_ns_by_id(id, nd);
+	if (nsid) {
+		if (pid_rst_prio(pid, nsid->pid))
+			nsid->pid = pid;
+		return 0;
 	}
 
 	nsid = rst_new_ns_id(id, pid, nd);
-- 
1.8.4.2




More information about the CRIU mailing list