Unverified Commit 8092c431 by Edward Thomson Committed by GitHub

Merge pull request #4905 from palmin/proxy_stream_close

make proxy_stream_close close target stream even on errors
parents 788fccc4 f4835e44
...@@ -809,6 +809,7 @@ static int proxy_stream_close(git_writestream *s) ...@@ -809,6 +809,7 @@ static int proxy_stream_close(git_writestream *s)
{ {
struct proxy_stream *proxy_stream = (struct proxy_stream *)s; struct proxy_stream *proxy_stream = (struct proxy_stream *)s;
git_buf *writebuf; git_buf *writebuf;
git_error_state error_state = {0};
int error; int error;
assert(proxy_stream); assert(proxy_stream);
...@@ -826,6 +827,11 @@ static int proxy_stream_close(git_writestream *s) ...@@ -826,6 +827,11 @@ static int proxy_stream_close(git_writestream *s)
git_buf_sanitize(proxy_stream->output); git_buf_sanitize(proxy_stream->output);
writebuf = proxy_stream->output; writebuf = proxy_stream->output;
} else { } else {
/* close stream before erroring out taking care
* to preserve the original error */
giterr_state_capture(&error_state, error);
proxy_stream->target->close(proxy_stream->target);
giterr_state_restore(&error_state);
return error; return error;
} }
......
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