[CRIU] [PATCH v2 01/14] files: Close ctl tty via generic engine

Kirill Tkhai ktkhai at virtuozzo.com
Thu Dec 28 16:08:55 MSK 2017


Just mark the fle as "fake" and the engine will do all the work.

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

diff --git a/criu/files.c b/criu/files.c
index 60abfa422..11b87e1fe 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -903,7 +903,7 @@ int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id)
 	e->fd		= reserve_service_fd(CTL_TTY_OFF);
 	e->type		= FD_TYPES__TTY;
 
-	if (collect_fd(pid, e, rst_info, false)) {
+	if (collect_fd(pid, e, rst_info, true)) {
 		xfree(e);
 		return -1;
 	}
diff --git a/criu/tty.c b/criu/tty.c
index 636d551c7..e4cfd9d7b 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -733,7 +733,6 @@ int tty_restore_ctl_terminal(struct file_desc *d, int fd)
 	close(slave);
 err:
 	pty_free_fake_reg(&fake);
-	close(fd);
 	return ret ? -1 : 0;
 }
 



More information about the CRIU mailing list