diff --git a/builtins/shopt.def b/builtins/shopt.def index ba97e702..5ecabde4 100644 --- a/builtins/shopt.def +++ b/builtins/shopt.def @@ -83,6 +83,7 @@ extern int extended_quote; extern int check_window_size; extern int glob_ignore_case, match_ignore_case; extern int hup_on_exit; +extern int no_reparent; extern int xpg_echo; extern int gnu_error_format; extern int check_jobs_at_exit; @@ -247,6 +248,7 @@ static struct { { "nocaseglob", &glob_ignore_case, (shopt_set_func_t *)NULL }, { "nocasematch", &match_ignore_case, (shopt_set_func_t *)NULL }, { "noexpand_translation", &singlequote_translations, (shopt_set_func_t *)NULL }, + { "noreparent", &no_reparent, (shopt_set_func_t *)NULL }, { "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL }, { "patsub_replacement", &patsub_replacement, (shopt_set_func_t *)NULL }, #if defined (PROGRAMMABLE_COMPLETION) @@ -365,6 +367,7 @@ reset_shopt_options () glob_star = 0; gnu_error_format = 0; hup_on_exit = 0; + no_reparent = 0; inherit_errexit = 0; interactive_comments = 1; lastpipe_opt = 0; diff --git a/jobs.c b/jobs.c index b96230fa..572e599c 100644 --- a/jobs.c +++ b/jobs.c @@ -65,6 +65,8 @@ # include #endif /* hpux && !TERMIOS_TTY_DRIVER */ +#include + #include "bashansi.h" #include "bashintl.h" #include "shell.h" @@ -221,6 +223,8 @@ PROCESS *the_pipeline = (PROCESS *)NULL; /* If this is non-zero, do job control. */ int job_control = 1; +int no_reparent = 0; + /* Are we running in background? (terminal_pgrp != shell_pgrp) */ int running_in_background = 0; @@ -2223,6 +2227,9 @@ make_child (command, flags) /* Restore top-level signal mask, including unblocking SIGTERM */ restore_sigmask (); + + if (no_reparent && prctl(PR_SET_PDEATHSIG, SIGTERM)) + sys_error("prctl"); if (job_control) {