diff options
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/login_tty.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libutil/login_tty.c b/lib/libutil/login_tty.c index 51299bd..a14e244 100644 --- a/lib/libutil/login_tty.c +++ b/lib/libutil/login_tty.c @@ -37,17 +37,21 @@ static char sccsid[] = "@(#)login_tty.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> -#include <sys/ioctl.h> #include <libutil.h> #include <stdlib.h> +#include <termios.h> #include <unistd.h> int login_tty(int fd) { - (void) setsid(); - if (ioctl(fd, TIOCSCTTY, (char *)NULL) == -1) + pid_t s; + + s = setsid(); + if (s == -1) + return (-1); + if (tcsetsid(fd, s) == -1) return (-1); (void) dup2(fd, 0); (void) dup2(fd, 1); |