Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-23 Thread Junio C Hamano
Jens Lindström writes: > On Tue, Oct 22, 2013 at 8:42 PM, Junio C Hamano wrote: >> Duy Nguyen writes: > >>> Life would have been simpler if fd[1] was _always_ closed by >>> send_pack(), like in c20181e (start_command(), if .in/.out > 0, closes >>> file descriptors, not the callers - 2008-02-21)

Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-23 Thread Jens Lindström
On Tue, Oct 22, 2013 at 8:42 PM, Junio C Hamano wrote: > Duy Nguyen writes: >> Life would have been simpler if fd[1] was _always_ closed by >> send_pack(), like in c20181e (start_command(), if .in/.out > 0, closes >> file descriptors, not the callers - 2008-02-21). > > Yeah, that was also my fir

Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-22 Thread Junio C Hamano
Duy Nguyen writes: > On Tue, Oct 22, 2013 at 7:10 PM, Jens Lindström wrote: > ... >> + if (!args->stateless_rpc) >> + /* Closed by pack_objects() via start_command() */ >> + fd[1] = -1; >> } > ... > Life would have been simpler if

Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-22 Thread Jens Lindström
On Tue, Oct 22, 2013 at 2:39 PM, Duy Nguyen wrote: > Not your itch. But if you have time you may want to fix fetch-pack > too. It has the same problem. fetch-pack.c:get_pack() with > use_sideband == 0 passes fd[0] to start_command(), then later its > caller transport.c:fetch_refs_via_pack() close

Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-22 Thread Duy Nguyen
On Tue, Oct 22, 2013 at 7:10 PM, Jens Lindström wrote: > From: Jens Lindstrom > > In send_pack(), clear the fd passed to pack_objects() by setting > it to -1, since pack_objects() closes the fd (via a call to > run_command()). > > Not doing so risks having git_transport_push(), caller of > send_p

[PATCH] Clear fd after closing to avoid double-close error

2013-10-22 Thread Jens Lindström
From: Jens Lindstrom In send_pack(), clear the fd passed to pack_objects() by setting it to -1, since pack_objects() closes the fd (via a call to run_command()). Not doing so risks having git_transport_push(), caller of send_pack(), closing the fd again, possibly incorrectly closing some other o