]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
stripper: Keep a reference to the jail
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2024 16:40:54 +0000 (16:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2024 16:40:54 +0000 (16:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c
src/libpakfire/include/pakfire/stripper.h
src/libpakfire/stripper.c

index e2b19388d47a54c04fb07962f5cff098abb6f02c..169b7627e18dbfea78f992349eecb10b97e57091 100644 (file)
@@ -1301,7 +1301,7 @@ static int pakfire_build_strip(struct pakfire_build* build) {
        int r;
 
        // Create a new stripper
-       r = pakfire_stripper_create(&stripper, build->pakfire, build->buildroot);
+       r = pakfire_stripper_create(&stripper, build->pakfire, build->jail, build->buildroot);
        if (r < 0)
                goto ERROR;
 
index dd30ced67fc45b7d831fea5b5cb27234d0f425e8..9233b4759bfbb60a1ff75fea790aee5fc2a0624a 100644 (file)
 
 struct pakfire_stripper;
 
+#include <pakfire/jail.h>
+#include <pakfire/pakfire.h>
+
 int pakfire_stripper_create(struct pakfire_stripper** stripper,
-       struct pakfire* pakfire, const char* path);
+       struct pakfire* pakfire, struct pakfire_jail* jail, const char* path);
 
 struct pakfire_stripper* pakfire_stripper_ref(struct pakfire_stripper* stripper);
 struct pakfire_stripper* pakfire_stripper_unref(struct pakfire_stripper* stripper);
index f3dedf975c6d15b05ab0785836106b4ee8925d42..db68343310094db58fb30d3dd1931ef883e58fa9 100644 (file)
@@ -37,6 +37,9 @@ struct pakfire_stripper {
        // Pakfire
        struct pakfire* pakfire;
 
+       // Jail
+       struct pakfire_jail* jail;
+
        // Path
        char path[PATH_MAX];
 
@@ -45,7 +48,7 @@ struct pakfire_stripper {
 };
 
 int pakfire_stripper_create(struct pakfire_stripper** stripper,
-               struct pakfire* pakfire, const char* path) {
+               struct pakfire* pakfire, struct pakfire_jail* jail, const char* path) {
        struct pakfire_stripper* s = NULL;
        int r;
 
@@ -60,6 +63,9 @@ int pakfire_stripper_create(struct pakfire_stripper** stripper,
        // Store a reference to Pakfire
        s->pakfire = pakfire_ref(pakfire);
 
+       // Store a reference to the jail
+       s->jail = pakfire_jail_ref(jail);
+
        // Initialize the reference counter
        s->nrefs = 1;
 
@@ -88,6 +94,8 @@ static void pakfire_stripper_free(struct pakfire_stripper* stripper) {
                pakfire_filelist_unref(stripper->filelist);
        if (stripper->pakfire)
                pakfire_unref(stripper->pakfire);
+       if (stripper->jail)
+               pakfire_jail_unref(stripper->jail);
        if (stripper->ctx)
                pakfire_ctx_unref(stripper->ctx);
        free(stripper);