Re: [PATCH] git_open_noatime: return with errno=0 on success
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Aug 5, 2015, 08:59 UTC
- Message-ID
- <CA+55aFx-WXxCbVTWdJHFf4WA2MNXS3UMerv4cD1wtsZGaQkJLw@mail.gmail.com>
- In-Reply-To
- <xmqqfv3y6a24.fsf@gitster.dls.corp.google.com>
On Tue, Aug 4, 2015 at 11:03 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > I would agree it is a good idea to clear it after seeing the first > open fail due to lack of O_NOATIME before trying open for the second > time, iow, more like this?
So I don't think this is _wrong_ per se, but I think the deeper issue is that somebody cares about 'errno' here in the first place.
A stale 'errno' generally shouldn't matter, because we either
(a) return success (and nobody should look at errno)
or
(b) return an error later, without setting errno for that _later_ error.
and I think either of those two situations are the real bug, and this "clear stale errno" is just a workaround.
But as mentioned, I don't think clearign errno is wrong, so I'm not objecting to the patch. I just suspect there's something else goign on too..
Linus