Re: [PATCH v2 2/5] reftable/stack: refactor reloading to use file descriptor
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 16, 2024, 16:44 UTC
- Message-ID
- <xmqqv87t1b4u.fsf@gitster.g>
- In-Reply-To
- <20240116151447.GD2119690@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
>> So overall this works as intended, even though I would not consider it >> to be the cleanest way to handle this. Unless you or others think that >> this should be refactored I'll leave it as-is for now though. > > Thanks for confirming. I think we can leave your patch as-is. If > anything, I would say that stat_validity_update() should check for "fd < > 0" itself. Not because I think fstat() is unlikely to behave differently > on some platform, but simply because it more clearly documents the > expectation.
Thanks, I agree with your point that we should avoid calling system functions that take a file descriptor with a known-invalid (like negative) one.