[RFC/PATCH] transport-helper: initialize debug flag before starting threads

2014-12-08 Thread Jeff King
The transport_debug() function uses a static variable to lazily cache the boolean value of $TRANSPORT_DEBUG. If a program uses transport-helper's bidirectional_transfer_loop (as remote-ext and remote-fd do), then two threads may both try to write the variable at the same time. We can fix this by

Re: [RFC/PATCH] transport-helper: initialize debug flag before starting threads

2014-12-08 Thread Jeff King
On Mon, Dec 08, 2014 at 03:22:06AM -0500, Jeff King wrote: /* Print bidirectional transfer loop debug message. */ __attribute__((format (printf, 1, 2))) static void transfer_debug(const char *fmt, ...) { va_list args; char msgbuf[PBUFFERSIZE]; - static int debug_enabled