From 3773366a25978a57fe990c7d2951e88d38dcb067 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 3 Apr 2010 23:29:01 +0200 Subject: [PATCH] Fixed blocking bug in channel_poll. This is a backport from 514ab6eed2b520d14a1dce783e3180db11f460a4. --- libssh/channels.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libssh/channels.c b/libssh/channels.c index b1f83161..9014a2d6 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -2007,9 +2007,10 @@ int channel_poll(ssh_channel channel, int is_stderr){ stdbuf = channel->stderr_buffer; } - while (buffer_get_rest_len(stdbuf) == 0 && channel->remote_eof == 0) { - if (ssh_handle_packets(channel->session) <= 0) { - break; + if (buffer_get_rest_len(stdbuf) == 0 && channel->remote_eof == 0) { + if (ssh_handle_packets(channel->session) == SSH_ERROR) { + leave_function(); + return SSH_ERROR; } }