aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-06-18 19:08:54 +0200
committerAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-06-23 16:14:27 +0200
commit750e4f3f9d3ec879929801d65a500ec3ad84ff67 (patch)
tree5c1b7531d162e6110aca73ada251fcae9a4b96df
parentb0518552f19fcf2da3dd265d892205dac23a1b8e (diff)
downloadlibssh-750e4f3f9d3ec879929801d65a500ec3ad84ff67.tar.gz
libssh-750e4f3f9d3ec879929801d65a500ec3ad84ff67.tar.xz
libssh-750e4f3f9d3ec879929801d65a500ec3ad84ff67.zip
channel: Do not return error if the server closed the channel
If the server properly closed the channel, the client should not return error if it finds the channel closed. Fixes T231 Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--src/channels.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/channels.c b/src/channels.c
index 9fe309d0..607bd568 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -2932,15 +2932,16 @@ int ssh_channel_read_timeout(ssh_channel channel,
if (session->session_state == SSH_SESSION_STATE_ERROR) {
return SSH_ERROR;
}
+ /* If the server closed the channel properly, there is nothing to do */
+ if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) {
+ return 0;
+ }
if (channel->state == SSH_CHANNEL_STATE_CLOSED) {
ssh_set_error(session,
SSH_FATAL,
"Remote channel is closed.");
return SSH_ERROR;
}
- if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) {
- return 0;
- }
len = ssh_buffer_get_len(stdbuf);
/* Read count bytes if len is greater, everything otherwise */
len = (len > count ? count : len);