Re: [PATCH 01/41] usage.c: move format processing out of die_errno()
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 3, 2016, 09:39 UTC
- Message-ID
- <CACsJy8DS5-dL8p8iMQs5B1++GaXNQWwdxUeaMCeZ12OoQcPO7Q@mail.gmail.com>
- In-Reply-To
- <20160503044528.GA32259@sigill.intra.peff.net>
On Tue, May 3, 2016 at 11:45 AM, Jeff King <peff@peff.net> wrote:
Show 16 quoted lines
> On Mon, May 02, 2016 at 11:26:02AM -0700, Junio C Hamano wrote: > >> Caller supplied buffer would be the way to go when multiple threads >> could be showing errors and warnings, right? >> >> It would not make too much of a difference for die(), though. > > I think it can matter for die(). This is happening above the pluggable > die_routine() layer, so it's possible for an async task to call die() > which will end in pthread_exit(), while the main program is calling > die() to end in regular exit(). > > I imagine it's exceedingly unlikely, and of course both threads are > dying anyway, but it could result in some pretty weird memory errors. > It's probably worth taking precautions against, especially because it's > to easy to do so.
So, sum it up, the new fmt_with_err() will take a buffer and size. die_errno() sticks to its static buffer as before. error_errno() and warning_errno() can allocate 1k on stack to be more multithread-friendly. Let me know if some other change is needed.
-- Duy