[CRIU] [PATCH 1/2] files: Fix invalid fds lists order

Pavel Begunkov asml.silence at gmail.com
Fri Jun 30 22:29:07 MSK 2017


fds in lists should be sorted in ascending order, but open_fdinfos
reorder them in descending order. For example, because of this
files.c:find_used_fd doen't work properly due to incorrect order
assumption and early termination.

Signed-off-by: Pavel Begunkov <asml.silence at gmail.com>
---
 criu/files.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index a36eb366e..4a263c438 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1198,9 +1198,9 @@ static int open_fdinfos(struct pstree_item *me)
 				 */
 				list_del(&fle->ps_list);
 				if (!fle->fake)
-					list_add(&fle->ps_list, &completed);
+					list_add_tail(&fle->ps_list, &completed);
 				else
-					list_add(&fle->ps_list, &fake);
+					list_add_tail(&fle->ps_list, &fake);
 			}
 			if (ret == 1)
 			       again = true;
-- 
2.11.1



More information about the CRIU mailing list