From e654cf38800228c363d47a507139bcca5bf31d29 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 13 May 2020 13:04:52 +0200 Subject: slave: configure pts to be the controlling terminal of the forked process --- slave.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'slave.c') diff --git a/slave.c b/slave.c index edd8e2cb..57bedc75 100644 --- a/slave.c +++ b/slave.c @@ -10,6 +10,7 @@ #include #include +#include #include #define LOG_MODULE "slave" @@ -93,6 +94,12 @@ slave_exec(int ptmx, char *argv[], int err_fd, bool login_shell) goto err; } + if (ioctl(pts, TIOCSCTTY, 0) < 0) { + LOG_ERRNO("failed to configure controlling terminal"); + goto err; + } + + if (dup2(pts, STDIN_FILENO) == -1 || dup2(pts, STDOUT_FILENO) == -1 || dup2(pts, STDERR_FILENO) == -1) -- cgit v1.3