From: Junio C Hamano Date: Tue, 16 Jan 2024 16:44:17 GMT Subject: Re: [PATCH v2 2/5] reftable/stack: refactor reloading to use file descriptor Message-ID: In-Reply-To: <20240116151447.GD2119690@coredump.intra.peff.net> Jeff King writes: >> 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.