From: Taylor Blau Date: Tue, 11 Jan 2022 02:11:20 GMT Subject: Re: [PATCH 1/1] fetch: fix deadlock when cleaning up lockfiles in async signals Message-ID: In-Reply-To: <2d8c1619-74ab-62b3-3a30-8e500a16649e@gmail.com> On Sat, Jan 08, 2022 at 10:54:35AM +0000, Phillip Wood wrote: > > 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