[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] session: ssh_handle_packets_termination() SSH_AGAIN bug fix


ssh_handle_packets_termination() must not return SSH_OK when exiting due to
a timeout while the termination function still returns 1.

Signed-off-by: Nicolas Viennot <nicolas@xxxxxxxxxxx>
---
 src/session.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/session.c b/src/session.c
index 4e71394..fe5d897 100644
--- a/src/session.c
+++ b/src/session.c
@@ -537,8 +537,10 @@ int ssh_handle_packets_termination(ssh_session session, int timeout,
 		ret = ssh_handle_packets(session, tm);
 		if(ret == SSH_ERROR)
 		  break;
-		if(ssh_timeout_elapsed(&ts,timeout))
+		if(ssh_timeout_elapsed(&ts,timeout)) {
+		  ret = fct(user) ? SSH_OK : SSH_AGAIN;
 		  break;
+		}
 		tm = ssh_timeout_update(&ts, timeout);
 	}
 	return ret;
-- 
1.8.2.1


References:
[PATCH 1/2] channels: allow channel_open() to return SSH_AGAINNicolas Viennot <nicolas@xxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org