From 11dc25966d5edb21ef51fcf6446db58c13f98f01 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Wed, 1 Oct 2025 18:06:59 +0100 Subject: [PATCH] If stop_at_size is true, do not read more than control.size even if that is 0 (#166). --- src/pv/transfer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pv/transfer.c b/src/pv/transfer.c index 0585c22..a4823ae 100644 --- a/src/pv/transfer.c +++ b/src/pv/transfer.c @@ -347,7 +347,7 @@ static int pv__transfer_read(pvstate_t state, int fd, bool *eof_in, bool *eof_ou * * This isn't workable in line mode. */ - if (state->control.stop_at_size && state->control.size > 0 && !state->control.linemode) { + if (state->control.stop_at_size && !state->control.linemode) { off_t bytes_remaining_to_read = state->control.size - state->transfer.total_bytes_read; if (bytes_can_read > (size_t) bytes_remaining_to_read) bytes_can_read = (size_t) bytes_remaining_to_read;