stream_to_pack: xread does not guarantee to read all requested bytes
The deflate loop in bulk-checkin::stream_to_pack expects to get all bytes from a file that it requests to read in a single function call. But it used xread(), which does not give that guarantee. Replace it by read_in_full(). Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Aug 20, 2013 at 11:15 UTC
e92527c97cfa26bf6e42381cf1b7035950c36e69
1 file changed
+1
-1
bulk-checkin.c
+1
-1
@@ -114,7 +114,7 @@ static int stream_to_pack(struct bulk_checkin_state *state,
114
115
if (size && !s.avail_in) {
116
ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf);
117
- if (xread(fd, ibuf, rsize) != rsize)
117
+ if (read_in_full(fd, ibuf, rsize) != rsize)
118
die("failed to read %d bytes from '%s'",
119
(int)rsize, path);
120
offset += rsize;