Thread (30 messages) flat view 30 messages, 3 authors, 2016-06-15

Re: [PATCH 08/10] revert: Introduce HEAD, TODO files to persist state, plan

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:51:26

Hi Jeff,

Jeff King writes:
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help