From 7b9328fc86a8d2156924d15f15eb153f7d8302dc Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 30 Jan 2025 11:18:04 +0000 Subject: [PATCH] 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 --- src/pakfire/repo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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); -- 2.39.5