[CRIU] [PATCH 2/4] files: Re-use keep_fd_for_future wider

Pavel Emelyanov xemul at virtuozzo.com
Tue Jan 24 23:54:08 PST 2017


The tail of the recv_fd_from_peer() matches this routine :)
So call one and rename, since it no longer keeps fd for
future only.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/files.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index 2cde4ad..5a3d700 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -878,7 +878,7 @@ static bool task_fle(struct pstree_item *task, struct fdinfo_list_entry *fle)
 	return false;
 }
 
-static int keep_fd_for_future(struct fdinfo_list_entry *fle, int fd)
+static int plant_fd(struct fdinfo_list_entry *fle, int fd)
 {
 	BUG_ON(fle->received);
 	fle->received = 1;
@@ -911,13 +911,12 @@ again:
 			pr_err("Unexpected fle %p, pid=%d\n", tmp, current->pid.virt);
 			return -1;
 		}
-		if (keep_fd_for_future(tmp, fd))
+		if (plant_fd(tmp, fd))
 			return -1;
 		goto again;
 	}
-	fle->received = 1;
 
-	if (reopen_fd_as(fle->fe->fd, fd) < 0)
+	if (plant_fd(fle, fd))
 		return -1;
 
 	return 0;
-- 
2.1.4



More information about the CRIU mailing list