aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-10-10 09:40:34 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-10-10 09:40:34 +0200
commit942559d321551e93cd6bae0b03de03e7cc13042c (patch)
treea0e3b17567d6e5fd6f8d3f8c8f91b2d0ba69712e
parent80d179f9fe013d727f571f4730ebbe4d228c9382 (diff)
zip.c: Fix endless loop on empty archives
When an empty directory is to be downloaded, z->lread would always equal zero because read_file is never called. Therefore, it is more sensible not to assume any number of bytes, and just dump as much data as possible into buf.
-rw-r--r--zip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/zip.c b/zip.c
index 5af30c2..79cf833 100644
--- a/zip.c
+++ b/zip.c
@@ -53,7 +53,7 @@ static void free_zip(void *const p)
static int dump_final(void *const buf, const size_t n, bool *const done,
void *const user, struct zip *const z)
{
- const ssize_t r = read(z->fds[0], buf, z->lread);
+ const ssize_t r = read(z->fds[0], buf, n);
if (r < 0)
{