From a2e944b9df4f0164936d3babbb910a2479718f52 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 20:31:22 +0000 Subject: Apply patch libssh-0.9.4-do-not-return-error-server-closed-channel.patch patch_name: libssh-0.9.4-do-not-return-error-server-closed-channel.patch present_in_specfile: true location_in_specfile: 3 --- diff --git a/src/channels.c b/src/channels.c index 05dcf8f..f64646e 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);