From: Michael Tremer Date: Sun, 29 Dec 2024 16:40:54 +0000 (+0000) Subject: stripper: Keep a reference to the jail X-Git-Tag: 0.9.30~668 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d11f1a5677157b31fbc06f0e9ce131eeb4db83ab;p=pakfire.git stripper: Keep a reference to the jail Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index e2b19388d..169b7627e 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -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; diff --git a/src/libpakfire/include/pakfire/stripper.h b/src/libpakfire/include/pakfire/stripper.h index dd30ced67..9233b4759 100644 --- a/src/libpakfire/include/pakfire/stripper.h +++ b/src/libpakfire/include/pakfire/stripper.h @@ -28,8 +28,11 @@ struct pakfire_stripper; +#include +#include + 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); diff --git a/src/libpakfire/stripper.c b/src/libpakfire/stripper.c index f3dedf975..db6834331 100644 --- a/src/libpakfire/stripper.c +++ b/src/libpakfire/stripper.c @@ -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);