Merge branch 'js/xread-in-full'

A call to xread() was used without a loop around to cope with short
read in the codepath to stream new contents to a pack.

* js/xread-in-full:
  stream_to_pack: xread does not guarantee to read all requested bytes
This commit is contained in:
Junio C Hamano 2013-09-11 14:59:46 -07:00
Родитель 42e5fb2bf1 e92527c97c
Коммит 0a3bc7d298
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -114,7 +114,7 @@ static int stream_to_pack(struct bulk_checkin_state *state,
if (size && !s.avail_in) { if (size && !s.avail_in) {
ssize_t rsize = size < sizeof(ibuf) ? size : sizeof(ibuf); 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'", die("failed to read %d bytes from '%s'",
(int)rsize, path); (int)rsize, path);
offset += rsize; offset += rsize;