[CRIU] [PATCH v3 03/26] files: Move closing fle's transport_fd to recv_fd_from_peer()

Kirill Tkhai ktkhai at virtuozzo.com
Mon Dec 5 06:07:51 PST 2016


No functional changes

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 c3ea2c4..55098e5 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;
 }
@@ -1099,7 +1100,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 47c4b55..cc9c29a 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1102,7 +1102,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 6c85fde..8131931 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