Re: [PATCH 08/10] revert: Introduce HEAD, TODO files to persist state, plan
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jun 8, 2011, 13:14 UTC
- Message-ID
- <BANLkTi=i2igTyusmVf8155VcFfVLQ==u3A@mail.gmail.com>
- In-Reply-To
- <20110602142933.GA32487@sigill.intra.peff.net>
Hi Jeff,
Jeff King writes:
Show 14 quoted lines
> Doesn't lock_file handle multiple locking already via the on_list parameter?
>
> $ grep -A2 on_list lockfile.c
> if (!lk->on_list) {
> lk->next = lock_file_list;
> lock_file_list = lk;
> lk->on_list = 1;
> }
>
> However, I think you have a bigger problem, which is that you are
> allocating the lock_file on the stack in persist_todo and persist_head.
> So by the time the atexit() handler is called, this storage has gone
> away and you are just reading random data (not to mention that it also
> should be zero-initialized before being passed to lock_file).Right. Thanks for the excellent pointer. I was struggling to see what was wrong on GDB; little did I realize that I was viewing nonsense. I solved the problem by making the lock_file variables static.
Thanks again, and sorry for the nonsense.
-- Ram