summaryrefslogtreecommitdiff
path: root/src/transports/git.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transports/git.c')
-rw-r--r--src/transports/git.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/transports/git.c b/src/transports/git.c
index 8d5a9d903..9fd3b47fc 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -76,18 +76,15 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
static int send_command(git_proto_stream *s)
{
git_buf request = GIT_BUF_INIT;
- size_t write_size;
int error;
- error = gen_proto(&request, s->cmd, s->url);
- if (error < 0)
+ if ((error = gen_proto(&request, s->cmd, s->url)) < 0)
goto cleanup;
- write_size = min(request.size, INT_MAX);
- error = (int)git_stream_write(s->io, request.ptr, write_size, 0);
+ if ((error = git_stream__write_full(s->io, request.ptr, request.size, 0)) < 0)
+ goto cleanup;
- if (error >= 0)
- s->sent_command = 1;
+ s->sent_command = 1;
cleanup:
git_buf_dispose(&request);
@@ -122,16 +119,15 @@ static int git_proto_stream_read(
static int git_proto_stream_write(
git_smart_subtransport_stream *stream,
const char *buffer,
- size_t buffer_len)
+ size_t len)
{
git_proto_stream *s = (git_proto_stream *)stream;
- size_t len = min(buffer_len, INT_MAX);
int error;
if (!s->sent_command && (error = send_command(s)) < 0)
return error;
- return (int)git_stream_write(s->io, buffer, len, 0);
+ return git_stream__write_full(s->io, buffer, len, 0);
}
static void git_proto_stream_free(git_smart_subtransport_stream *stream)