summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--session.c14
2 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f5a13d21d..7c7832556 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,11 @@
7 don't kill the login shells if the shells stdin/out/err is closed. 7 don't kill the login shells if the shells stdin/out/err is closed.
8 this should now work: 8 this should now work:
9 ssh -2n localhost 'exec > /dev/null 2>&1; sleep 10; exit 5'; echo ? 9 ssh -2n localhost 'exec > /dev/null 2>&1; sleep 10; exit 5'; echo ?
10 - markus@cvs.openbsd.org 2001/10/11 13:45:21
11 [session.c]
12 delay detach of session if a channel gets closed but the child is
13 still alive. however, release pty, since the fd's to the child are
14 already closed.
10 15
1120011010 1620011010
12 - (djm) OpenBSD CVS Sync 17 - (djm) OpenBSD CVS Sync
@@ -6705,4 +6710,4 @@
6705 - Wrote replacements for strlcpy and mkdtemp 6710 - Wrote replacements for strlcpy and mkdtemp
6706 - Released 1.0pre1 6711 - Released 1.0pre1
6707 6712
6708$Id: ChangeLog,v 1.1601 2001/10/12 01:35:04 djm Exp $ 6713$Id: ChangeLog,v 1.1602 2001/10/12 01:35:50 djm Exp $
diff --git a/session.c b/session.c
index 6ba2e7c77..e9d8ceb73 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.107 2001/10/10 22:18:47 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.108 2001/10/11 13:45:21 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -1865,6 +1865,9 @@ session_pty_cleanup(void *session)
1865 */ 1865 */
1866 if (close(s->ptymaster) < 0) 1866 if (close(s->ptymaster) < 0)
1867 error("close(s->ptymaster): %s", strerror(errno)); 1867 error("close(s->ptymaster): %s", strerror(errno));
1868
1869 /* unlink pty from session */
1870 s->ttyfd = -1;
1868} 1871}
1869 1872
1870static void 1873static void
@@ -1963,8 +1966,15 @@ session_close_by_channel(int id, void *arg)
1963 } 1966 }
1964 debug("session_close_by_channel: channel %d child %d", id, s->pid); 1967 debug("session_close_by_channel: channel %d child %d", id, s->pid);
1965 if (s->pid != 0) { 1968 if (s->pid != 0) {
1966 /* delay detach */
1967 debug("session_close_by_channel: channel %d: has child", id); 1969 debug("session_close_by_channel: channel %d: has child", id);
1970 /*
1971 * delay detach of session, but release pty, since
1972 * the fd's to the child are already closed
1973 */
1974 if (s->ttyfd != -1) {
1975 fatal_remove_cleanup(session_pty_cleanup, (void *)s);
1976 session_pty_cleanup(s);
1977 }
1968 return; 1978 return;
1969 } 1979 }
1970 /* detach by removing callback */ 1980 /* detach by removing callback */