summaryrefslogtreecommitdiff
path: root/pty.c
diff options
context:
space:
mode:
authordamien <damien>2000-04-20 13:12:58 +0000
committerdamien <damien>2000-04-20 13:12:58 +0000
commitb8814982eba9fb2cd38dfa1feeb72eb08539eff9 (patch)
treecc1de6fe0755c03166236445c14420cbf57b2da6 /pty.c
parente374ae660a924e7a123dd889b1c2ed2d9fe045e2 (diff)
downloadopenssh-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.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/pty.c b/pty.c
index c6af6f47..21ddab5c 100644
--- a/pty.c
+++ b/pty.c
@@ -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)