]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
ctx: Set a flag when we are running inside the jail
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2024 16:38:18 +0000 (16:38 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2024 16:38:18 +0000 (16:38 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/ctx.h
src/libpakfire/jail.c

index 0806e2825d42e1aeebe0a87eec2c76ecaf923459..696985e3686efa004b5951d924223af1df061df1 100644 (file)
@@ -38,6 +38,10 @@ struct pakfire_ctx* pakfire_ctx_unref(struct pakfire_ctx* ctx);
 
 enum pakfire_ctx_flags {
        PAKFIRE_CTX_OFFLINE = (1 << 0),
+
+#ifdef PAKFIRE_PRIVATE
+       PAKFIRE_CTX_IN_JAIL = (1 << 1),
+#endif /* PAKFIRE_PRIVATE */
 };
 
 int pakfire_ctx_has_flag(struct pakfire_ctx* ctx, int flag);
index c61ebc2ec532ebf7d480b0c3e7300c86e70c89ed..ede54b88610429d6cc9658acbceb2919eb3413ac 100644 (file)
@@ -1130,6 +1130,9 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        // Redirect any logging to our log pipe
        pakfire_ctx_set_log_callback(jail->ctx, pakfire_jail_log_redirect, ctx);
 
+       // Tell the context that we are running inside the jail now
+       pakfire_ctx_set_flag(jail->ctx, PAKFIRE_CTX_IN_JAIL);
+
        // Fetch my own PID
        pid_t pid = getpid();