diff options
Diffstat (limited to 'src/libgit2/transports/git.c')
-rw-r--r-- | src/libgit2/transports/git.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libgit2/transports/git.c b/src/libgit2/transports/git.c index 591e2ab03..53611f2a7 100644 --- a/src/libgit2/transports/git.c +++ b/src/libgit2/transports/git.c @@ -7,7 +7,7 @@ #include "common.h" -#include "netops.h" +#include "net.h" #include "stream.h" #include "streams/socket.h" #include "git2/sys/transport.h" @@ -95,22 +95,21 @@ static int git_proto_stream_read( size_t buf_size, size_t *bytes_read) { - int error; git_proto_stream *s = (git_proto_stream *)stream; - gitno_buffer buf; + ssize_t ret; + int error; *bytes_read = 0; if (!s->sent_command && (error = send_command(s)) < 0) return error; - gitno_buffer_setup_fromstream(s->io, &buf, buffer, buf_size); + ret = git_stream_read(s->io, buffer, min(buf_size, INT_MAX)); - if ((error = gitno_recv(&buf)) < 0) - return error; - - *bytes_read = buf.offset; + if (ret < 0) + return -1; + *bytes_read = (size_t)ret; return 0; } |