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

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]