convert less-trivial versions of "write_in_full() != len"
The prior commit converted many sites to check the return value of write_in_full() for negativity, rather than a mismatch with the input length. This patch covers similar cases, but where the return value is stored in an intermediate variable. These should get the same treatment, but they need to be reviewed more carefully since it would be a bug if the return value is stored in an unsigned type (which indeed, it is in one of the cases). Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
06f46f237a
commit
564bde9ae6
@ -2039,7 +2039,7 @@ static int log_ref_write_fd(int fd, const struct object_id *old_oid,
|
||||
|
||||
written = len <= maxlen ? write_in_full(fd, logrec, len) : -1;
|
||||
free(logrec);
|
||||
if (written != len)
|
||||
if (written < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user