From: Michael Tremer Date: Thu, 30 Jan 2025 11:18:04 +0000 (+0000) Subject: repo: Move compression detection X-Git-Tag: 0.9.30~264 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b9328fc86a8d2156924d15f15eb153f7d8302dc;p=pakfire.git repo: Move compression detection It is easier to run this when we read the database instead of in the lower level SOLV reading function because inheriting the FILE handle becomes difficult. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/repo.c b/src/pakfire/repo.c index 63575cda..0be69b29 100644 --- a/src/pakfire/repo.c +++ b/src/pakfire/repo.c @@ -595,6 +595,13 @@ static int pakfire_repo_read_database(struct pakfire_repo* repo, const char* pat goto ERROR; } + // Automatically detect compression + f = pakfire_xfopen(f, "r"); + if (!f) { + r = -errno; + goto ERROR; + } + // Drop any previous data r = pakfire_repo_clear(repo); if (r) @@ -1448,11 +1455,6 @@ ERROR: int pakfire_repo_read_solv(struct pakfire_repo* repo, FILE *f, int flags) { int r; - // Automatically detect compression - f = pakfire_xfopen(f, "r"); - if (!f) - return -errno; - // Import SOLV data r = repo_add_solv(repo->repo, f, flags);