summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--remote-curl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 775d614303..d9abbf5f75 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -575,7 +575,14 @@ static int rpc_service(struct rpc_state *rpc, struct discovery *heads)
close(client.in);
client.in = -1;
- strbuf_read(&rpc->result, client.out, 0);
+ if (!err) {
+ strbuf_read(&rpc->result, client.out, 0);
+ } else {
+ char buf[4096];
+ for (;;)
+ if (xread(client.out, buf, sizeof(buf)) <= 0)
+ break;
+ }
close(client.out);
client.out = -1;