From 47225042c9a3024f0468610c1142c26432dd452d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:16:24 -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. Only Linux builds this path. A stand-in header type checked it here. --- 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