path: root/streaming.c
diff options
authorJeff King <>2017-09-13 17:16:28 (GMT)
committerJunio C Hamano <>2017-09-14 06:17:59 (GMT)
commit564bde9ae69dc3d60e764078745275b637f90991 (patch)
tree45365f924c0622698493ee62ee0ede6c51133e4c /streaming.c
parent06f46f237afa823c0a2775e60ed8fbd80e7c751f (diff)
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 <> Reviewed-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'streaming.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/streaming.c b/streaming.c
index 9afa66b..c8b85e4 100644
--- a/streaming.c
+++ b/streaming.c
@@ -539,7 +539,7 @@ int stream_blob_to_fd(int fd, const struct object_id *oid, struct stream_filter
kept = 0;
wrote = write_in_full(fd, buf, readlen);
- if (wrote != readlen)
+ if (wrote < 0)
goto close_and_exit;
if (kept && (lseek(fd, kept - 1, SEEK_CUR) == (off_t) -1 ||