[CRIU] [PATCH RFC v2 05/14] files: Move closing fle's transport_fd to recv_fd_from_peer()

Kirill Tkhai ktkhai at virtuozzo.com
Fri Oct 28 14:06:24 PDT 2016


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files.c   |    2 +-
 criu/pipes.c   |    1 -
 criu/sk-unix.c |    1 -
 criu/tty.c     |    1 -
 4 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index f50264b..c4da1a7 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -970,6 +970,7 @@ int recv_fd_from_peer(struct fdinfo_list_entry *fle)
 		pr_err("Received wrong fle\n");
 		return -1;
 	}
+	close(fle->fe->fd);
 
 	return fd;
 }
@@ -1100,7 +1101,6 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle)
 		pr_err("Can't get fd %d\n", tmp);
 		return -1;
 	}
-	close(fle->fe->fd);
 
 	if (reopen_fd_as(fle->fe->fd, tmp) < 0)
 		return -1;
diff --git a/criu/pipes.c b/criu/pipes.c
index 31f436e..9a61cff 100644
--- a/criu/pipes.c
+++ b/criu/pipes.c
@@ -242,7 +242,6 @@ static int recv_pipe_fd(struct pipe_info *pi)
 		pr_err("Can't get fd %d\n", tmp);
 		return -1;
 	}
-	close(fd);
 
 	if (pi->reopen)
 		fd = reopen_pipe(tmp, pi->pe->flags);
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 7d9728a..fbe29c2 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1101,7 +1101,6 @@ static int open_unixsk_pair_slave(struct unix_sk_info *ui)
 		pr_err("Can't recv pair slave\n");
 		return -1;
 	}
-	close(fle->fe->fd);
 
 	if (bind_unix_sk(sk, ui))
 		return -1;
diff --git a/criu/tty.c b/criu/tty.c
index 3dc60cd..08e5211 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -924,7 +924,6 @@ static int receive_tty(struct tty_info *info)
 	pr_info("\tWaiting tty fd %d (pid %d)\n", fle->fe->fd, fle->pid);
 
 	fd = recv_fd_from_peer(fle);
-	close(fle->fe->fd);
 	if (fd < 0) {
 		pr_err("Can't get fd %d\n", fd);
 		return -1;



More information about the CRIU mailing list