Jeff King <peff@xxxxxxxx> 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.