From 5993935f76e66c957f02efaa8fc0c8ff8a3f92c9 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 15 Oct 2000 12:21:32 +1100 Subject: [PATCH] - (djm) Fix ssh2 hang on background processes at logout. --- ChangeLog | 3 +++ rijndael.h | 2 ++ serverloop.c | 3 ++- session.c | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9b37a5fcd..552bcfcaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +20001015 + - (djm) Fix ssh2 hang on background processes at logout. + 20001014 - (bal) Add support for realpath and getcwd for platforms with broken or missing realpath implementations for sftp-server. diff --git a/rijndael.h b/rijndael.h index c13f18c95..09c425742 100644 --- a/rijndael.h +++ b/rijndael.h @@ -1,6 +1,8 @@ #ifndef _RIJNDAEL_H_ #define _RIJNDAEL_H_ +#include "config.h" + /* 1. Standard types for AES cryptography source code */ typedef u_int8_t u1byte; /* an 8 bit unsigned character type */ diff --git a/serverloop.c b/serverloop.c index 25320348b..0c07a2821 100644 --- a/serverloop.c +++ b/serverloop.c @@ -671,7 +671,8 @@ server_loop2(void) if (packet_not_very_much_data_to_write()) channel_output_poll(); wait_until_can_do_something(&readset, &writeset, 0); - if (child_terminated) { + if (child_terminated && child_has_selected) { + /* XXX: race - assumes only one child has terminated */ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) session_close_by_pid(pid, status); child_terminated = 0; diff --git a/session.c b/session.c index a12e2a0d8..9a213923c 100644 --- a/session.c +++ b/session.c @@ -1846,9 +1846,13 @@ session_exit_message(Session *s, int status) * interested in data we write. * Note that we must not call 'chan_read_failed', since there could * be some more data waiting in the pipe. + * djm - This is no longer true as we have allowed one pass through + * the select loop before killing the connection */ if (c->ostate != CHAN_OUTPUT_CLOSED) chan_write_failed(c); + if (c->istate != CHAN_INPUT_CLOSED) + chan_read_failed(c); s->chanid = -1; }