From b97875950bf27ac72ef74d10f51beee023a4dee9 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 27 Sep 2026 15:56:45 -1000 Subject: Stop the sendfile loop at the end of a short slot sendfile returns zero at the end of the file, and the loop only ended once the offset reached the size recorded when the slot was opened, so a slot cut shorter in between spun the request forever. --- source/cache.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') diff --git a/source/cache.c b/source/cache.c index 62bb623..60e071b 100644 --- a/source/cache.c +++ b/source/cache.c @@ -150,6 +150,10 @@ static int print_slot(struct cache_slot *slot) break; return errno; } + // Zero means the file ended short of the size it had when it + // was opened, and the read loop below finds that end. + if (ret == 0) + break; if (off == size) return 0; } while (1); -- cgit 2.12.1