Commit 700f0aff by Carlos Martín Nieto

Merge pull request #3562 from mgorny/ssh-read-stderr-fail

ssh_stream_read(): fix possible *bytes_read < 0 branch
parents a3776489 02fdc2db
......@@ -136,9 +136,14 @@ static int ssh_stream_read(
* not-found error, so read from stderr and signal EOF on
* stderr.
*/
if (rc == 0 && (rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
giterr_set(GITERR_SSH, "%*s", rc, buffer);
return GIT_EEOF;
if (rc == 0) {
if ((rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
giterr_set(GITERR_SSH, "%*s", rc, buffer);
return GIT_EEOF;
} else if (rc < LIBSSH2_ERROR_NONE) {
ssh_error(s->session, "SSH could not read stderr");
return -1;
}
}
......
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