From dd65bd7e7d1e8e7f9f0ca517cecaec3bcceae375 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 28 Nov 2026 19:51:44 +0100 Subject: Don't push the outbuf for zstd chunks on errors --- src/ot_fullscrape.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ot_fullscrape.c b/src/ot_fullscrape.c index 3e3b6cb..00c08e0 100644 --- a/src/ot_fullscrape.c +++ b/src/ot_fullscrape.c @@ -381,7 +381,7 @@ static void fullscrape_make_zstd(int taskid, ot_tasktype mode) { /* Check if there still is enough buffer left */ while (outbuf.pos + OT_SCRAPE_MAXENTRYLEN > outbuf.size) { - iovector.iov_len = outbuf.size; + iovector.iov_len = outbuf.pos; if (workqueue_pushchunked(taskid, &iovector)) { free(iovector.iov_base); @@ -419,6 +419,11 @@ static void fullscrape_make_zstd(int taskid, ot_tasktype mode) { inbuf.src = (const void *)"ee"; inbuf.size = strlen("ee"); inbuf.pos = 0; + } else { + /* Nothing more to feed, and with no torrent written nothing was set */ + inbuf.src = (const void *)""; + inbuf.size = 0; + inbuf.pos = 0; } more_bytes = ZSTD_compressStream2(zstream, &outbuf, &inbuf, ZSTD_e_end); -- cgit v1.3