From dafbb1c4f4c1266b31eafa967c024d6f79789842 Mon Sep 17 00:00:00 2001 From: Edan Bedrik <3d4nb3@gmail.com> Date: Tue, 8 May 2018 21:39:16 +0300 Subject: [PATCH] url: return relevant error value from apk_istream_fetch --- src/url.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/url.c b/src/url.c index 18a7b9d..414a109 100644 --- a/src/url.c +++ b/src/url.c @@ -110,14 +110,21 @@ static const struct apk_istream_ops fetch_istream_ops = { static struct apk_istream *apk_istream_fetch(const char *url, time_t since) { - struct apk_fetch_istream *fis; + struct apk_fetch_istream *fis = NULL; struct url *u; fetchIO *io = NULL; - int rc = -ENOMEM; + int rc = -EIO; u = fetchParseURL(url); + if (!u) { + rc = -EAPKBADURL; + goto err; + } fis = malloc(sizeof(*fis)); - if (!fis || !u) goto err; + if (!fis) { + rc = -ENOMEM; + goto err; + } u->last_modified = since; io = fetchXGet(u, &fis->urlstat, (apk_force & APK_FORCE_REFRESH) ? "Ci" : "i");