From e92527c97cfa26bf6e42381cf1b7035950c36e69 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 20 Aug 2013 11:15:26 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- bulk-checkin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bulk-checkin.c') diff --git a/bulk-checkin.c b/bulk-checkin.c index 6b0b6d4904..118c62528b 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -114,7 +114,7 @@ static int stream_to_pack(struct bulk_checkin_state *state, if (size && !s.avail_in) { ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf); - if (xread(fd, ibuf, rsize) != rsize) + if (read_in_full(fd, ibuf, rsize) != rsize) die("failed to read %d bytes from '%s'", (int)rsize, path); offset += rsize; -- cgit v1.2.3