Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion bubblewrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,21 @@ usage (int ecode, FILE *out)
static void
handle_die_with_parent (void)
{
if (opt_die_with_parent && prctl (PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0)
pid_t ppid;

if (!opt_die_with_parent)
return;

ppid = getppid ();
if (prctl (PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != 0)
die_with_error ("prctl");

/* Close the race where our parent exits before PR_SET_PDEATHSIG takes effect. */
if (getppid () != ppid)
{
(void) kill (getpid (), SIGKILL);
_exit (1);
}
}

static void
Expand Down