]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Initialize keystore when pakfire is being initialized
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 30 Jul 2021 15:40:13 +0000 (15:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 30 Jul 2021 15:40:13 +0000 (15:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index 44cf7b918378004b0e297039ebeca933f3085f43..85e8d7911deddf5cc8dfc27a93468bdb2017969f 100644 (file)
@@ -951,6 +951,11 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, const char* path,
                goto ERROR;
        }
 
+       // Initialize keystore
+       r = pakfire_keystore_init(p, &p->gpgctx);
+       if (r)
+               goto ERROR;
+
        // Populate pool
        r = pakfire_populate_pool(p);
        if (r)
@@ -1066,15 +1071,6 @@ PAKFIRE_EXPORT int pakfire_bind(struct pakfire* pakfire, const char* src, const
 }
 
 gpgme_ctx_t pakfire_get_gpgctx(struct pakfire* pakfire) {
-       // Create a new context if not done, yet
-       if (!pakfire->gpgctx) {
-               int r = pakfire_keystore_init(pakfire, &pakfire->gpgctx);
-               if (r) {
-                       ERROR(pakfire, "Could not initialize keystore: %m\n");
-                       return NULL;
-               }
-       }
-
        return pakfire->gpgctx;
 }