summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/session.c')
-rw-r--r--usr.bin/ssh/session.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index fa68c391732..b1d49314249 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/session.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.106 2001/10/09 21:59:41 markus Exp $");
+RCSID("$OpenBSD: session.c,v 1.107 2001/10/10 22:18:47 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -1576,36 +1576,29 @@ session_close_by_channel(int id, void *arg)
{
Session *s = session_by_channel(id);
if (s == NULL) {
- debug("session_close_by_channel: no session for channel %d", id);
+ debug("session_close_by_channel: no session for id %d", id);
return;
}
- /* disconnect channel */
- channel_cancel_cleanup(s->chanid);
- s->chanid = -1;
-
- debug("session_close_by_channel: channel %d kill %d", id, s->pid);
+ debug("session_close_by_channel: channel %d child %d", id, s->pid);
if (s->pid != 0) {
- /* notify child */
- if (kill(s->pid, SIGHUP) < 0)
- error("session_close_by_channel: kill %d: %s",
- s->pid, strerror(errno));
+ /* delay detach */
+ debug("session_close_by_channel: channel %d: has child", id);
+ return;
}
+ /* detach by removing callback */
+ channel_cancel_cleanup(s->chanid);
+ s->chanid = -1;
session_close(s);
}
void
-session_close_all(void)
+session_destroy_all(void)
{
int i;
for(i = 0; i < MAX_SESSIONS; i++) {
Session *s = &sessions[i];
- if (s->used) {
- if (s->chanid != -1) {
- channel_cancel_cleanup(s->chanid);
- s->chanid = -1;
- }
+ if (s->used)
session_close(s);
- }
}
}