Re: [PATCH 3/7] read_in_full: reset errno before reading
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Sep 26, 2017, 00:20 UTC
- Message-ID
- <20170926002020.GQ27425@aiede.mtv.corp.google.com>
- In-Reply-To
- <20170926001724.cxuwsdadjbqqmnig@sigill.intra.peff.net>
Jeff King wrote:
Show 7 quoted lines
> I definitely would prefer to avoid EIO, or anything that an actual > read() might return. > > 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, Jonathan