]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
jail: Kill child when parent dies
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Aug 2022 13:48:31 +0000 (13:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Aug 2022 13:48:31 +0000 (13:48 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/jail.c

index 83063e5662c86a96f2112413dc3f20d06ede5c5b..3591c354d8f0fcecd814d72eaa35f36046f16b87 100644 (file)
@@ -1069,6 +1069,13 @@ static int pakfire_jail_child(struct pakfire_jail* jail, struct pakfire_jail_exe
        // Redirect any logging to our log pipe
        pakfire_set_log_callback(jail->pakfire, pakfire_jail_log, &ctx->pipes);
 
+       // Die with parent
+       r = prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
+       if (r) {
+               ERROR(jail->pakfire, "Could not configure to die with parent: %m\n");
+               return 126;
+       }
+
        // Fetch my own PID
        pid_t pid = getpid();