reftable: handle interrupted reads

There are calls to pread(3P) and read(3P) where we don't properly handle interrupts. Convert them to use `pread_in_full()` and `read_in_full()`, respectively. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Dec 11, 2023 at 10:07 UTC 917a2b3ce990717ccce5ff372766d9ffd41239f6
2 files changed +2 -2
reftable/blocksource.c
+1 -1
@@ -109,7 +109,7 @@ static int file_read_block(void *v, struct reftable_block *dest, uint64_t off,
109 struct file_block_source *b = v;
110 assert(off + size <= b->size);
111 dest->data = reftable_malloc(size);
112 - if (pread(b->fd, dest->data, size, off) != size)
112 + if (pread_in_full(b->fd, dest->data, size, off) != size)
113 return -1;
114 dest->len = size;
115 return size;
reftable/stack.c
+1 -1
@@ -92,7 +92,7 @@ static int fd_read_lines(int fd, char ***namesp)
92 }
93
94 buf = reftable_malloc(size + 1);
95 - if (read(fd, buf, size) != size) {
95 + if (read_in_full(fd, buf, size) != size) {
96 err = REFTABLE_IO_ERROR;
97 goto done;
98 }