mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
channels: Set error state when closed channel is read
When an attempt to read a closed channel happens, set the session error state properly. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
d78a29eb79
commit
8e69d435ef
@@ -2766,8 +2766,13 @@ int ssh_channel_read_timeout(ssh_channel channel,
|
|||||||
/*
|
/*
|
||||||
* If the channel is closed or in an error state, reading from it is an error
|
* If the channel is closed or in an error state, reading from it is an error
|
||||||
*/
|
*/
|
||||||
if (session->session_state == SSH_SESSION_STATE_ERROR ||
|
if (session->session_state == SSH_SESSION_STATE_ERROR) {
|
||||||
channel->state == SSH_CHANNEL_STATE_CLOSED) {
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
if (channel->state == SSH_CHANNEL_STATE_CLOSED) {
|
||||||
|
ssh_set_error(session,
|
||||||
|
SSH_FATAL,
|
||||||
|
"Remote channel is closed.");
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) {
|
if (channel->remote_eof && ssh_buffer_get_len(stdbuf) == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user