Commit 6417f5a3 authored by Jakub Jelen's avatar Jakub Jelen

channels: Avoid returning SSH_AGAIN from ssh_channel_poll_timeout()

This addresses a regression introduced in 3bad0607, partially fixed in 022409e9,
but the function was still able to return SSH_AGAIN, which was not expected by
callers.

Based on discussion in [1] and [2]

[1] !101
[2] https://www.libssh.org/archive/libssh/2020-03/0000029.htmlSigned-off-by: Jakub Jelen's avatarJakub Jelen <[email protected]>
Reviewed-by: Anderson Sasaki's avatarAnderson Toshiyuki Sasaki <[email protected]>
parent fe0fcbbc
......@@ -3116,6 +3116,12 @@ int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr)
session->session_state == SSH_SESSION_STATE_ERROR) {
rc = SSH_ERROR;
goto out;
} else if (rc == SSH_AGAIN) {
/* If the above timeout expired, it is ok and we do not need to
* attempt to check the read buffer. The calling functions do not
* expect us to return SSH_AGAIN either here. */
rc = SSH_OK;
goto out;
}
len = ssh_buffer_get_len(stdbuf);
if (len > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment