Re: [PATCH v2 3/7] prefer "!=" when checking read_in_full() result

2017-09-27 Thread Jeff King
On Wed, Sep 27, 2017 at 03:59:15PM +0900, Junio C Hamano wrote: > Jeff King writes: > > > diff --git a/csum-file.c b/csum-file.c > > index a172199e44..2adae04073 100644 > > --- a/csum-file.c > > +++ b/csum-file.c > > @@ -19,7 +19,7 @@ static void flush(struct sha1file *f, const void *buf, > > u

Re: [PATCH v2 3/7] prefer "!=" when checking read_in_full() result

2017-09-26 Thread Junio C Hamano
Jeff King writes: > diff --git a/csum-file.c b/csum-file.c > index a172199e44..2adae04073 100644 > --- a/csum-file.c > +++ b/csum-file.c > @@ -19,7 +19,7 @@ static void flush(struct sha1file *f, const void *buf, > unsigned int count) > > if (ret < 0) > die_e

[PATCH v2 3/7] prefer "!=" when checking read_in_full() result

2017-09-26 Thread Jeff King
Comparing the result of read_in_full() using less-than is potentially dangerous, as a negative return value may be converted to an unsigned type and be considered a success. This is discussed further in 561598cfcf (read_pack_header: handle signed/unsigned comparison in read result, 2017-09-13). Ea