diff options
author | damien <damien> | 2000-04-20 13:12:58 +0000 |
---|---|---|
committer | damien <damien> | 2000-04-20 13:12:58 +0000 |
commit | b8814982eba9fb2cd38dfa1feeb72eb08539eff9 (patch) | |
tree | cc1de6fe0755c03166236445c14420cbf57b2da6 /pty.c | |
parent | e374ae660a924e7a123dd889b1c2ed2d9fe045e2 (diff) | |
download | openssh-b8814982eba9fb2cd38dfa1feeb72eb08539eff9.tar.gz |
- 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) |