Re: [PATCH 7/7] add xread_in_full() helper

2017-09-25 Thread Jeff King
On Mon, Sep 25, 2017 at 03:16:08PM -0700, Jonathan Nieder wrote: > Jeff King wrote: > > > Many callers of read_in_full() expect to see exactly "len" > > bytes, and die if that isn't the case. > > micronit: Can this be named read_in_full_or_die? > > Otherwise it's too easy to mistake for a funct

Re: [PATCH 7/7] add xread_in_full() helper

2017-09-25 Thread Jonathan Nieder
Jeff King wrote: > Many callers of read_in_full() expect to see exactly "len" > bytes, and die if that isn't the case. micronit: Can this be named read_in_full_or_die? Otherwise it's too easy to mistake for a function like xread, which has different semantics. I realize that xmalloc, xmemdupz,

[PATCH 7/7] add xread_in_full() helper

2017-09-25 Thread Jeff King
Many callers of read_in_full() expect to see exactly "len" bytes, and die if that isn't the case. Since there are two interesting error cases: 1. We saw a read() error. 2. We saw EOF with fewer bytes than expected. we would ideally distinguish between them when reporting to the user. Let's a