[CRIU] [PATCH 13/37] ns: clean up dump_namespaces

Andrey Vagin avagin at openvz.org
Fri Apr 18 07:42:51 PDT 2014


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

diff --git a/namespaces.c b/namespaces.c
index a86bc55..77920f0 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -494,14 +494,10 @@ int dump_namespaces(struct pstree_item *item, unsigned int ns_flags)
 		return -1;
 	}
 
-	ns = ns_ids;
-
-	while (ns) {
+	for (ns = ns_ids; ns; ns = ns->next) {
 		/* Skip current namespaces, which are in the list too  */
-		if (ns->pid == getpid()) {
-			ns = ns->next;
+		if (ns->pid == getpid())
 			continue;
-		}
 
 		pid = fork();
 		if (pid < 0) {
@@ -524,7 +520,6 @@ int dump_namespaces(struct pstree_item *item, unsigned int ns_flags)
 			pr_err("Namespaces dumping finished with error %d\n", status);
 			return -1;
 		}
-		ns = ns->next;
 	}
 
 	pr_info("Namespaces dump complete\n");
-- 
1.8.5.3



More information about the CRIU mailing list