From: Michael Tremer Date: Sat, 12 Oct 2024 19:14:24 +0000 (+0000) Subject: xfer: Fail creation when in offline mode X-Git-Tag: 0.9.30~1052 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7822eceb019d83c729b7205a660461d3b6ac102d;p=pakfire.git xfer: Fail creation when in offline mode Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/httpclient.c b/src/libpakfire/httpclient.c index 128f1eb8e..15cc955d0 100644 --- a/src/libpakfire/httpclient.c +++ b/src/libpakfire/httpclient.c @@ -395,12 +395,6 @@ int pakfire_httpclient_create(struct pakfire_httpclient** client, struct pakfire_httpclient* c = NULL; int r; - // Fail if the context is flagged as offline - if (pakfire_ctx_has_flag(ctx, PAKFIRE_CTX_OFFLINE)) { - CTX_ERROR(ctx, "Cannot initialize downloader in offline mode\n"); - return -EPERM; - } - // Allocate a new object c = calloc(1, sizeof(*c)); if (!c) diff --git a/src/libpakfire/xfer.c b/src/libpakfire/xfer.c index 7ede9220d..4f4b0c932 100644 --- a/src/libpakfire/xfer.c +++ b/src/libpakfire/xfer.c @@ -346,6 +346,12 @@ int pakfire_xfer_create(struct pakfire_xfer** xfer, char buffer[PATH_MAX]; int r; + // Fail if the context is flagged as offline + if (pakfire_ctx_has_flag(ctx, PAKFIRE_CTX_OFFLINE)) { + CTX_ERROR(ctx, "Cannot initialize a transfer in offline mode\n"); + return -EPERM; + } + // Format the URL r = __pakfire_string_vformat(buffer, sizeof(buffer), url, args); if (r < 0)