summaryrefslogtreecommitdiff
path: root/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'pty.c')
-rw-r--r--pty.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/pty.c b/pty.c
index f5bb86124..d610a4543 100644
--- a/pty.c
+++ b/pty.c
@@ -118,6 +118,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
118 close(*ptyfd); 118 close(*ptyfd);
119 return 0; 119 return 0;
120 } 120 }
121#ifndef HAVE_CYGWIN
121 /* Push the appropriate streams modules, as described in Solaris pts(7). */ 122 /* Push the appropriate streams modules, as described in Solaris pts(7). */
122 if (ioctl(*ttyfd, I_PUSH, "ptem") < 0) 123 if (ioctl(*ttyfd, I_PUSH, "ptem") < 0)
123 error("ioctl I_PUSH ptem: %.100s", strerror(errno)); 124 error("ioctl I_PUSH ptem: %.100s", strerror(errno));
@@ -127,6 +128,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
127 if (ioctl(*ttyfd, I_PUSH, "ttcompat") < 0) 128 if (ioctl(*ttyfd, I_PUSH, "ttcompat") < 0)
128 error("ioctl I_PUSH ttcompat: %.100s", strerror(errno)); 129 error("ioctl I_PUSH ttcompat: %.100s", strerror(errno));
129#endif 130#endif
131#endif
130 return 1; 132 return 1;
131#else /* HAVE_DEV_PTMX */ 133#else /* HAVE_DEV_PTMX */
132#ifdef HAVE_DEV_PTS_AND_PTC 134#ifdef HAVE_DEV_PTS_AND_PTC
@@ -208,9 +210,9 @@ void
208pty_make_controlling_tty(int *ttyfd, const char *ttyname) 210pty_make_controlling_tty(int *ttyfd, const char *ttyname)
209{ 211{
210 int fd; 212 int fd;
211#ifdef HAVE_VHANGUP 213#ifdef USE_VHANGUP
212 void *old; 214 void *old;
213#endif /* HAVE_VHANGUP */ 215#endif /* USE_VHANGUP */
214 216
215 /* First disconnect from the old controlling tty. */ 217 /* First disconnect from the old controlling tty. */
216#ifdef TIOCNOTTY 218#ifdef TIOCNOTTY
@@ -242,21 +244,21 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
242 */ 244 */
243 ioctl(*ttyfd, TIOCSCTTY, NULL); 245 ioctl(*ttyfd, TIOCSCTTY, NULL);
244#endif /* TIOCSCTTY */ 246#endif /* TIOCSCTTY */
245#ifdef HAVE_VHANGUP 247#ifdef USE_VHANGUP
246 old = signal(SIGHUP, SIG_IGN); 248 old = signal(SIGHUP, SIG_IGN);
247 vhangup(); 249 vhangup();
248 signal(SIGHUP, old); 250 signal(SIGHUP, old);
249#endif /* HAVE_VHANGUP */ 251#endif /* USE_VHANGUP */
250 fd = open(ttyname, O_RDWR); 252 fd = open(ttyname, O_RDWR);
251 if (fd < 0) { 253 if (fd < 0) {
252 error("%.100s: %.100s", ttyname, strerror(errno)); 254 error("%.100s: %.100s", ttyname, strerror(errno));
253 } else { 255 } else {
254#ifdef HAVE_VHANGUP 256#ifdef USE_VHANGUP
255 close(*ttyfd); 257 close(*ttyfd);
256 *ttyfd = fd; 258 *ttyfd = fd;
257#else /* HAVE_VHANGUP */ 259#else /* USE_VHANGUP */
258 close(fd); 260 close(fd);
259#endif /* HAVE_VHANGUP */ 261#endif /* USE_VHANGUP */
260 } 262 }
261 /* Verify that we now have a controlling tty. */ 263 /* Verify that we now have a controlling tty. */
262 fd = open("/dev/tty", O_WRONLY); 264 fd = open("/dev/tty", O_WRONLY);