summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-10-12 11:35:50 +1000
committerDamien Miller <djm@mindrot.org>2001-10-12 11:35:50 +1000
commit0585d51a52350409f63b687a02619a7617643309 (patch)
tree45d5190ff8c5273f1b71277514dda4714158ce05 /session.c
parent3ec2759ad40f054c152c753db046ac55f9670d14 (diff)
- markus@cvs.openbsd.org 2001/10/11 13:45:21
[session.c] delay detach of session if a channel gets closed but the child is still alive. however, release pty, since the fd's to the child are already closed.
Diffstat (limited to 'session.c')
-rw-r--r--session.c14
1 files changed, 12 insertions, 2 deletions
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 */