diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-08-07 01:29:16 +0200 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-08-07 01:29:16 +0200 |
commit | 6db66ff3877f52110cda3104e798d91091af7200 (patch) | |
tree | 29ce760512a91bdd7bdc6a7961e3d851404afeff /sshpty.c | |
parent | - (bal) ssh-keyscan double -lssh hack due to seed_rng(). (diff) | |
download | openssh-6db66ff3877f52110cda3104e798d91091af7200.tar.xz openssh-6db66ff3877f52110cda3104e798d91091af7200.zip |
- (bal) Second around of UNICOS patches. A few other things left.
Patches by William L. Jones <jones@mail.utexas.edu>
Diffstat (limited to 'sshpty.c')
-rw-r--r-- | sshpty.c | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -162,6 +162,34 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) } return 1; #else /* HAVE_DEV_PTS_AND_PTC */ +#ifdef _CRAY + char buf[64]; + int i; + int highpty; + +#ifdef _SC_CRAY_NPTY + highpty = sysconf(_SC_CRAY_NPTY); + if (highpty == -1) + highpty = 128; +#else + highpty = 128; +#endif + + for (i = 0; i < highpty; i++) { + snprintf(buf, sizeof(buf), "/dev/pty/%03d", i); + *ptyfd = open(buf, O_RDWR|O_NOCTTY); + if (*ptyfd < 0) continue; + snprintf(namebuf, namebuflen, "/dev/ttyp%03d", i); + /* Open the slave side. */ + *ttyfd = open(namebuf, O_RDWR|O_NOCTTY); + if (*ttyfd < 0) { + error("%.100s: %.100s", namebuf, strerror(errno)); + close(*ptyfd); + } + return 1; + } + return 0; +#else /* BSD-style pty code. */ char buf[64]; int i; @@ -196,6 +224,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) return 1; } return 0; +#endif /* CRAY */ #endif /* HAVE_DEV_PTS_AND_PTC */ #endif /* HAVE_DEV_PTMX */ #endif /* HAVE__GETPTY */ @@ -218,6 +247,35 @@ pty_release(const char *ttyname) void pty_make_controlling_tty(int *ttyfd, const char *ttyname) { +#ifdef _CRAY + int fd; + + if (setsid() < 0) + error("setsid: %.100s", strerror(errno)); + + fd = open(ttyname, O_RDWR|O_NOCTTY); + if (fd >= 0) { + signal(SIGHUP, SIG_IGN); + ioctl(fd, TCVHUP, (char *)0); + signal(SIGHUP, SIG_DFL); + setpgid(0,0); + close(fd); + } else { + error("Failed to disconnect from controlling tty."); + } + + + debug("Setting controlling tty using TCSETCTTY.\n"); + ioctl(*ttyfd, TCSETCTTY, NULL); + + fd = open("/dev/tty", O_RDWR); + + if (fd < 0) + error("%.100s: %.100s", ttyname, strerror(errno)); + + close(*ttyfd); + *ttyfd = fd; +#else int fd; #ifdef USE_VHANGUP void *old; @@ -277,6 +335,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) else { close(fd); } +#endif } /* Changes the window size associated with the pty. */ |