From ccec36b07c421263e5b1f9a2fa9cc63c2c33dc22 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 26 Mar 2016 11:23:57 +1000 Subject: [PATCH] More experimental tty stdio work --- doors.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doors.c b/doors.c index 5a5c6b4..1af534c 100644 --- a/doors.c +++ b/doors.c @@ -6,6 +6,7 @@ #include #include #include +#include #if defined(linux) # include #else @@ -118,6 +119,9 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { int slave; fd_set fdset; int t; + int pipefd[2]; + + if (write_door32sys(socket, user) != 0) { return; @@ -137,10 +141,21 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { if (pid < 0) { return; } else if (pid == 0) { + + close(master); dup2(slave, 0); dup2(slave, 1); + + close(slave); + + setsid(); + + ioctl(0, TIOCSCTTY, 1); + execvp(cmd, arguments); } else { + pipe(pipefd); + while(1) { FD_ZERO(&fdset); FD_SET(master, &fdset);