From: Michael Tremer Date: Sat, 5 Oct 2024 15:34:05 +0000 (+0000) Subject: jail: Create a new systemd event loop X-Git-Tag: 0.9.30~1149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ae27c298f71085a51186b8a145ba1f814f5480f;p=pakfire.git jail: Create a new systemd event loop Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/jail.c b/src/libpakfire/jail.c index 5662ee202..f95c361f2 100644 --- a/src/libpakfire/jail.c +++ b/src/libpakfire/jail.c @@ -50,6 +50,9 @@ // libuuid #include +// systemd +#include + #include #include #include @@ -157,6 +160,7 @@ struct pakfire_jail { }; struct pakfire_jail_exec { + sd_event* loop; int flags; // PID (of the child) @@ -2349,6 +2353,13 @@ PAKFIRE_EXPORT int pakfire_jail_exec(struct pakfire_jail* jail, const char* argv CTX_DEBUG(jail->ctx, "Executing jail...\n"); + // Create a new event loop + r = sd_event_new(&ctx.loop); + if (r < 0) { + CTX_ERROR(jail->ctx, "Could not create a new event loop: %s\n", strerror(-r)); + goto ERROR; + } + // Enable networking in interactive mode if (ctx.flags & PAKFIRE_JAIL_PTY_FORWARDING) ctx.flags |= PAKFIRE_JAIL_HAS_NETWORKING; @@ -2502,6 +2513,9 @@ ERROR: #endif /* ENABLE_DEBUG */ pakfire_jail_close_pipe(jail, ctx.socket); + if (ctx.loop) + sd_event_unref(ctx.loop); + return exit; }