[01/12] files: Close ctl tty via generic engine

Submitted by Kirill Tkhai on Dec. 26, 2017, 3:45 p.m.

Details

Message ID 151430315474.1302.7121956204908653148.stgit@localhost.localdomain
State New
Series "Introduce custom per-task service fds placement"
Headers show

Commit Message

Kirill Tkhai Dec. 26, 2017, 3:45 p.m.
Just mark the fle as "fake" and the engine will do all the work.

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

Patch hide | download patch | download mbox

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;
 }