diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | session.c | 14 |
2 files changed, 18 insertions, 3 deletions
@@ -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 | ||
11 | 20011010 | 16 | 20011010 |
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 $ |
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.107 2001/10/10 22:18:47 markus Exp $"); | 36 | RCSID("$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 | ||
1870 | static void | 1873 | static 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 */ |