Re: [PATCH 1/1] fetch: fix deadlock when cleaning up lockfiles in async signals
On Sat, Jan 08, 2022 at 10:54:35AM +0000, Phillip Wood wrote:
Show 14 quoted lines
> > But is unlink() safe as-is? I'm not so sure. Reading signal-safety(7),
> > it's clearly on the list of functions that are OK to call. But reading
> > the errno section:
> >
> > (snip)
> >
> > We certainly not doing that, though that's nothing new, and so I wonder
> > why it doesn't seem to be an issue in practice.
>
> Because in this case we re-raise the signal and exit it does not matter if
> unlink() clobbers errno. If instead the program were to continue after
> handling the signal then we would have to save and restore errno to avoid
> interfering with the code that was running when the signal handler was
> called.
That makes perfect sense to me. Thanks for a clear explanation.
Taylor