Re: [PATCH 2/5] refs.c: do not die if locking fails in `write_pseudoref()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 May 2018 at 17:48, David Turner <novalis@xxxxxxxxxxx> wrote:
> On Sun, 2018-05-06 at 16:10 +0200, Martin Ågren wrote:
>> While at it, make the lock non-static.

> Re making the lock static, I wonder about the following case:
>
>       if (read_ref(pseudoref, &actual_old_oid))
>
> die("could not read ref '%s'", pseudoref);
>
> I think this calls exit(), and then atexit tries to clean up the lock
> files.  But since lock is no longer static, the stack may have been
> destroyed (I don't actually know whether this is true, so maybe someone
> else does).

Right. After commit 076aa2cbda (tempfile: auto-allocate tempfiles on
heap, 2017-09-05) this is safe though. Quite a few locks have already
been moved to the stack, e.g., in 14bca6c63c (sequencer: make lockfiles
non-static, 2018-02-27) and 02ae242fdd (checkout-index: simplify locking
logic, 2017-10-05).  I could add a note to the commit message to make
this clear, like "After 076aa2cbda, locks no longer need to be static."

Martin




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux