diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-26 19:43:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-26 19:43:33 +0000 |
commit | b1e286254a17fe2801979cd6d1f64eac77b2801d (patch) | |
tree | 609f43259c87847cd06cd29b4cdf960b33859557 /src/streams/mbedtls.c | |
parent | f56634f803eecb2df31461de32b7f477097c2a73 (diff) | |
parent | fac08837a50993be4d8fa023c8fc13408180ecc1 (diff) | |
download | libgit2-b1e286254a17fe2801979cd6d1f64eac77b2801d.tar.gz |
Merge pull request #4950 from libgit2/ethomson/warnings
Clean up some warnings
Diffstat (limited to 'src/streams/mbedtls.c')
-rw-r--r-- | src/streams/mbedtls.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/streams/mbedtls.c b/src/streams/mbedtls.c index 45f5b6e75..48d21dd69 100644 --- a/src/streams/mbedtls.c +++ b/src/streams/mbedtls.c @@ -303,22 +303,22 @@ static int mbedtls_set_proxy(git_stream *stream, const git_proxy_options *proxy_ return git_stream_set_proxy(st->io, proxy_options); } -ssize_t mbedtls_stream_write(git_stream *stream, const char *data, size_t len, int flags) +ssize_t mbedtls_stream_write(git_stream *stream, const char *data, size_t data_len, int flags) { - size_t read = 0; + ssize_t written = 0, len = min(data_len, SSIZE_MAX); mbedtls_stream *st = (mbedtls_stream *) stream; GIT_UNUSED(flags); do { - int error = mbedtls_ssl_write(st->ssl, (const unsigned char *)data + read, len - read); + int error = mbedtls_ssl_write(st->ssl, (const unsigned char *)data + written, len - written); if (error <= 0) { return ssl_set_error(st->ssl, error); } - read += error; - } while (read < len); + written += error; + } while (written < len); - return read; + return written; } ssize_t mbedtls_stream_read(git_stream *stream, void *data, size_t len) |