Skip to content

Commit 34df9fe

Browse files
committed
Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4
* js/maint-send-pack-stateless-rpc-deadlock-fix: sideband_demux(): fix decl-after-stmt send-pack: unbreak push over stateless rpc send-pack: avoid deadlock when pack-object dies early
2 parents 4201472 + 1c1f046 commit 34df9fe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

builtin/send-pack.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,11 @@ static void print_helper_status(struct ref *ref)
228228

229229
static int sideband_demux(int in, int out, void *data)
230230
{
231-
int *fd = data;
232-
int ret = recv_sideband("send-pack", fd[0], out);
231+
int *fd = data, ret;
232+
#ifdef NO_PTHREADS
233+
close(fd[1]);
234+
#endif
235+
ret = recv_sideband("send-pack", fd[0], out);
233236
close(out);
234237
return ret;
235238
}
@@ -339,6 +342,8 @@ int send_pack(struct send_pack_args *args,
339342
if (pack_objects(out, remote_refs, extra_have, args) < 0) {
340343
for (ref = remote_refs; ref; ref = ref->next)
341344
ref->status = REF_STATUS_NONE;
345+
if (args->stateless_rpc)
346+
close(out);
342347
if (use_sideband)
343348
finish_async(&demux);
344349
return -1;

0 commit comments

Comments
 (0)