summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-06-16 07:59:23 +1000
committerDamien Miller <djm@mindrot.org>2008-06-16 07:59:23 +1000
commitd310d51badf6bbd1df56c8a0971d24e2d3e61887 (patch)
treec9be17fd3c127b573f18ef9b1855e87e9f7f45af /session.c
parent307c1d10a78218fc2a67c3b285f90e701415004b (diff)
- djm@cvs.openbsd.org 2008/06/15 20:06:26
[channels.c channels.h session.c] don't call isatty() on a pty master, instead pass a flag down to channel_set_fds() indicating that te fds refer to a tty. Fixes a hang on exit on Solaris (bz#1463) in portable but is actually a generic bug; ok dtucker deraadt markus
Diffstat (limited to 'session.c')
-rw-r--r--session.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/session.c b/session.c
index 3ea783f63..d692bc709 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.c,v 1.239 2008/06/14 18:33:43 djm Exp $ */ 1/* $OpenBSD: session.c,v 1.240 2008/06/15 20:06:26 djm Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -98,7 +98,7 @@
98/* func */ 98/* func */
99 99
100Session *session_new(void); 100Session *session_new(void);
101void session_set_fds(Session *, int, int, int); 101void session_set_fds(Session *, int, int, int, int);
102void session_pty_cleanup(Session *); 102void session_pty_cleanup(Session *);
103void session_proctitle(Session *); 103void session_proctitle(Session *);
104int session_setup_x11fwd(Session *); 104int session_setup_x11fwd(Session *);
@@ -591,7 +591,7 @@ do_exec_no_pty(Session *s, const char *command)
591 close(perr[0]); 591 close(perr[0]);
592 perr[0] = -1; 592 perr[0] = -1;
593 } 593 }
594 session_set_fds(s, pin[1], pout[0], perr[0]); 594 session_set_fds(s, pin[1], pout[0], perr[0], 0);
595 } else { 595 } else {
596 /* Enter the interactive session. */ 596 /* Enter the interactive session. */
597 server_loop(pid, pin[1], pout[0], perr[0]); 597 server_loop(pid, pin[1], pout[0], perr[0]);
@@ -608,7 +608,7 @@ do_exec_no_pty(Session *s, const char *command)
608 */ 608 */
609 if (compat20) { 609 if (compat20) {
610 session_set_fds(s, inout[1], inout[1], 610 session_set_fds(s, inout[1], inout[1],
611 s->is_subsystem ? -1 : err[1]); 611 s->is_subsystem ? -1 : err[1], 0);
612 if (s->is_subsystem) 612 if (s->is_subsystem)
613 close(err[1]); 613 close(err[1]);
614 } else { 614 } else {
@@ -733,7 +733,7 @@ do_exec_pty(Session *s, const char *command)
733 s->ptymaster = ptymaster; 733 s->ptymaster = ptymaster;
734 packet_set_interactive(1); 734 packet_set_interactive(1);
735 if (compat20) { 735 if (compat20) {
736 session_set_fds(s, ptyfd, fdout, -1); 736 session_set_fds(s, ptyfd, fdout, -1, 1);
737 } else { 737 } else {
738 server_loop(pid, ptyfd, fdout, -1); 738 server_loop(pid, ptyfd, fdout, -1);
739 /* server_loop _has_ closed ptyfd and fdout. */ 739 /* server_loop _has_ closed ptyfd and fdout. */
@@ -2285,7 +2285,7 @@ session_input_channel_req(Channel *c, const char *rtype)
2285} 2285}
2286 2286
2287void 2287void
2288session_set_fds(Session *s, int fdin, int fdout, int fderr) 2288session_set_fds(Session *s, int fdin, int fdout, int fderr, int isatty)
2289{ 2289{
2290 if (!compat20) 2290 if (!compat20)
2291 fatal("session_set_fds: called for proto != 2.0"); 2291 fatal("session_set_fds: called for proto != 2.0");
@@ -2298,8 +2298,7 @@ session_set_fds(Session *s, int fdin, int fdout, int fderr)
2298 channel_set_fds(s->chanid, 2298 channel_set_fds(s->chanid,
2299 fdout, fdin, fderr, 2299 fdout, fdin, fderr,
2300 fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ, 2300 fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
2301 1, 2301 1, isatty, CHAN_SES_WINDOW_DEFAULT);
2302 CHAN_SES_WINDOW_DEFAULT);
2303} 2302}
2304 2303
2305/* 2304/*