diff options
author | Damien Miller <djm@mindrot.org> | 2000-04-20 23:12:58 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-04-20 23:12:58 +1000 |
commit | d0cff3ecc49204c03c06428f7b779b8a18c0486f (patch) | |
tree | 97eaecdaec4a134fc48d5704a33f4ad3ba9ca1f4 /pty.c | |
parent | 166fca8894807de71b741a779330bd23edfec013 (diff) |
- Merge fixes from Debian patch from Phil Hands <phil@hands.com>
- Allow setting of PAM service name through CFLAGS (SSHD_PAM_SERVICE)
- Use vhangup to clean up Linux ttys
- Force posix getopt processing on GNU libc systems
Diffstat (limited to 'pty.c')
-rw-r--r-- | pty.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -14,7 +14,7 @@ */ #include "includes.h" -RCSID("$Id: pty.c,v 1.18 2000/04/16 01:18:44 damien Exp $"); +RCSID("$Id: pty.c,v 1.19 2000/04/20 13:12:59 damien Exp $"); #ifdef HAVE_UTIL_H # include <util.h> @@ -201,6 +201,9 @@ void pty_make_controlling_tty(int *ttyfd, const char *ttyname) { int fd; +#ifdef HAVE_VHANGUP + void *old; +#endif /* HAVE_VHANGUP */ /* First disconnect from the old controlling tty. */ #ifdef TIOCNOTTY @@ -232,12 +235,22 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) */ ioctl(*ttyfd, TIOCSCTTY, NULL); #endif /* TIOCSCTTY */ +#ifdef HAVE_VHANGUP + old = signal(SIGHUP, SIG_IGN); + vhangup(); + signal(SIGHUP, old); +#endif /* HAVE_VHANGUP */ fd = open(ttyname, O_RDWR); - if (fd < 0) + if (fd < 0) { error("%.100s: %.100s", ttyname, strerror(errno)); - else + } else { +#ifdef HAVE_VHANGUP + close(*ttyfd); + *ttyfd = fd; +#else /* HAVE_VHANGUP */ close(fd); - +#endif /* HAVE_VHANGUP */ + } /* Verify that we now have a controlling tty. */ fd = open("/dev/tty", O_WRONLY); if (fd < 0) |