1
1

Fix missing _libssh2_error in _libssh2_channel_write.

In one case, the error code from `_libssh2_transport_read` was being returned from `_libssh2_channel_write` without setting it as the last error by calling `_libssh2_error`.  This commit fixes that.

Found when using a session whose socket had been inadvertently destroyed.  The calling code got confused because via `libssh2_session_last_error` it appeared no error had occurred, despite one being returned from the previous function.
Этот коммит содержится в:
Alexander Lamaison 2013-11-28 23:36:08 +00:00
родитель 61df22c460
Коммит 88366b5ec2

Просмотреть файл

@ -2023,8 +2023,10 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
rc = _libssh2_transport_read(session); rc = _libssh2_transport_read(session);
while (rc > 0); while (rc > 0);
if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN)) if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN)) {
return rc; return _libssh2_error(channel->session, rc,
"Failure while draining incoming flow");
}
if(channel->local.window_size <= 0) { if(channel->local.window_size <= 0) {
/* there's no room for data so we stop */ /* there's no room for data so we stop */