Skip to content

Commit e92527c

Browse files
j6tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1599999 commit e92527c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bulk-checkin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static int stream_to_pack(struct bulk_checkin_state *state,
114114

115115
if (size && !s.avail_in) {
116116
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)
118118
die("failed to read %d bytes from '%s'",
119119
(int)rsize, path);
120120
offset += rsize;

0 commit comments

Comments
 (0)