Re: [PATCH 3/7] read_in_full: reset errno before reading
- From
Jeff King <peff@peff.net>
- Date
- Sep 26, 2017, 00:25 UTC
- Message-ID
- <20170926002510.xmusj6fkvb25fm5w@sigill.intra.peff.net>
- In-Reply-To
- <20170926002020.GQ27425@aiede.mtv.corp.google.com>
On Mon, Sep 25, 2017 at 05:20:20PM -0700, Jonathan Nieder wrote:
Show 15 quoted lines
> > What do you think of ENODATA? The glibc text for it is pretty > > appropriate. If it's not available everywhere, we'd have to fallback to > > something else (EIO? 0?). I don't know how esoteric it is. The likely > > candidate to be lacking it is Windows. > > ENODATA with a fallback to ESPIPE sounds fine to me. > > read() would never produce ESPIPE because it doesn't seek. > > So that would be: > > /* errno value to use for early EOF */ > #ifndef ENODATA > #define ENODATA ESPIPE > #endif
Thanks, I'll re-roll with that (and thank you Stefan for mentioning ENODATA again; I came across it early in my search but discounted it as not quite right semantically. I should have been looking at the strerror() text, which is what really matters).
What do you think of patch 7 in light of this? If the short-read case gives us a sane errno, should we even bother trying to consistently handle its error separately?
-Peff