Skip to content

Commit 917a2b3

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e32b8ec commit 917a2b3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

reftable/blocksource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static int file_read_block(void *v, struct reftable_block *dest, uint64_t off,
109109
struct file_block_source *b = v;
110110
assert(off + size <= b->size);
111111
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)
113113
return -1;
114114
dest->len = size;
115115
return size;

reftable/stack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int fd_read_lines(int fd, char ***namesp)
9292
}
9393

9494
buf = reftable_malloc(size + 1);
95-
if (read(fd, buf, size) != size) {
95+
if (read_in_full(fd, buf, size) != size) {
9696
err = REFTABLE_IO_ERROR;
9797
goto done;
9898
}

0 commit comments

Comments
 (0)