[CRIU] [PATCH] files: Unify clone_service_fd()

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jan 26 01:58:43 PST 2017


Make this function more generic: we want to dup not only
transport socket of parent, but just all service fds, which
were not opened at the moment of clone() in parent. But,
yes, currently it's only transport socket.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/util.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/criu/util.c b/criu/util.c
index fa1d74965..96b9e95d6 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -481,11 +481,10 @@ int clone_service_fd(int id)
 		return 0;
 
 	for (i = SERVICE_FD_MIN + 1; i < SERVICE_FD_MAX; i++) {
-		int old = __get_service_fd(i, service_fd_id);
+		int old = get_service_fd(i);
 		int new = __get_service_fd(i, id);
 
-		/* Do not dup parent's transport fd */
-		if (i == TRANSPORT_FD_OFF)
+		if (old < 0)
 			continue;
 		ret = dup2(old, new);
 		if (ret == -1) {



More information about the CRIU mailing list