From d8d284d7c80bc7f48bb2d646b7e3ccdd9b001817 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Tue, 19 Jul 2022 15:06:34 +0200 Subject: [PATCH] lib/fetch: return 0 if buffer len is 0 and buf is NULL Previously it would return -1 when xbps would download an empty files. --- lib/fetch/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fetch/common.c b/lib/fetch/common.c index 53962790..b5d1a4e6 100644 --- a/lib/fetch/common.c +++ b/lib/fetch/common.c @@ -1490,10 +1490,10 @@ fetch_read(conn_t *conn, char *buf, size_t len) ssize_t rlen; int r; - if (!buf) - return -1; if (len == 0) return 0; + if (!buf) + return -1; if (conn->next_len != 0) { if (conn->next_len < len)