In fetch-pack, during a stateless RPC, printf is invoked after stdout is closed. Update the code to not do this, preserving the existing behavior. Signed-off-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx> --- builtin/fetch-pack.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index ae073ab24..24af3b7c5 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -191,10 +191,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) printf("connectivity-ok\n"); fflush(stdout); } - close(fd[0]); - close(fd[1]); - if (finish_connect(conn)) - return 1; + if (finish_connect(conn)) { + ret = 1; + goto cleanup; + } ret = !ref; @@ -218,11 +218,17 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) ret = 1; } + if (args.stateless_rpc) + goto cleanup; + while (ref) { printf("%s %s\n", oid_to_hex(&ref->old_oid), ref->name); ref = ref->next; } +cleanup: + close(fd[0]); + close(fd[1]); return ret; } -- 2.11.0.483.g087da7b7c-goog