]> git.ipfire.org Git - pakfire.git/commitdiff
repo: Move compression detection
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Jan 2025 11:18:04 +0000 (11:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Jan 2025 11:18:04 +0000 (11:18 +0000)
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 <michael.tremer@ipfire.org>
src/pakfire/repo.c

index 63575cdaffa6012eba0f21971fccdf56e1fbc11a..0be69b29ff220819f544e449d32055f55b309035 100644 (file)
@@ -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);