Re: [PATCH v4 19/32] commit_lock_file(): rollback lock file on failure to rename
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Sep 10, 2014, 12:55 UTC
- Message-ID
- <CACsJy8AOvyt3FxcnZKa+x77WJ90Zn7DhiBUpbQ8DhU-D3SLfyA@mail.gmail.com>
- In-Reply-To
- <20140910075519.GA16413@peff.net>
On Wed, Sep 10, 2014 at 2:55 PM, Jeff King <peff@peff.net> wrote:
> BTW, while grepping for commit_lock_file calls, I notice we often commit > the shallow file without checking the return code. I'm not sure what we > should do in each case, but I imagine that calling die() is probably > better than continuing as if it succeeded. +cc Duy
Noted. To be fixed soon. It looks like we could make gcc warn about ignoring return code like this with __attribute__((warn_unused_result)) (but I haven't tested). If it does help catch mishandling in future commit_lock_file calls and does not upset other compilers, we may want to add it to commit_lock_file.
-- Duy