aboutsummaryrefslogtreecommitdiff
path: root/slave.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-13 11:04:52 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-13 11:07:44 +0000
commite654cf38800228c363d47a507139bcca5bf31d29 (patch)
tree8f2e7dd42ca470edca287359900509a25d6f0cab /slave.c
parentMerge branch 'fcft-precompose' (diff)
slave: configure pts to be the controlling terminal of the forked process
Diffstat (limited to 'slave.c')
-rw-r--r--slave.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/slave.c b/slave.c
index edd8e2cb..57bedc75 100644
--- a/slave.c
+++ b/slave.c
@@ -10,6 +10,7 @@
#include <signal.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <fcntl.h>
#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)