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

ssh_stream_read(): fix possible *bytes_read < 0 branch
This commit is contained in:
Carlos Martín Nieto 2015-12-29 13:38:01 +00:00
commit 700f0aff24

View File

@ -136,9 +136,14 @@ static int ssh_stream_read(
* not-found error, so read from stderr and signal EOF on * not-found error, so read from stderr and signal EOF on
* stderr. * stderr.
*/ */
if (rc == 0 && (rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) { if (rc == 0) {
giterr_set(GITERR_SSH, "%*s", rc, buffer); if ((rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
return GIT_EEOF; 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;
}
} }