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.
This commit is contained in:
Duncan Overbruck 2022-07-19 15:06:34 +02:00
parent 93186276ee
commit d8d284d7c8
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35

View File

@ -1490,10 +1490,10 @@ fetch_read(conn_t *conn, char *buf, size_t len)
ssize_t rlen; ssize_t rlen;
int r; int r;
if (!buf)
return -1;
if (len == 0) if (len == 0)
return 0; return 0;
if (!buf)
return -1;
if (conn->next_len != 0) { if (conn->next_len != 0) {
if (conn->next_len < len) if (conn->next_len < len)