From 163a378b532c03c0199c489b6d829a84875e32c2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 5 Nov 2021 05:04:41 -0400 Subject: sandbox: restore SANDBOX_INTRACTV variable I incorrectly dropped this as unused a while back, but the bashrc hook definitely still relies on it for checking portage settings. I think I got confused by the interaction with SANDBOX_TESTING. Signed-off-by: Mike Frysinger --- src/environ.c | 6 +++++- src/sandbox.c | 2 +- src/sandbox.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/environ.c b/src/environ.c index ecff0dc..1535f06 100644 --- a/src/environ.c +++ b/src/environ.c @@ -241,7 +241,7 @@ static void sb_setenv(char ***envp, const char *name, const char *val) /* We setup the environment child side only to prevent issues with * setting LD_PRELOAD parent side */ -char **setup_environ(struct sandbox_info_t *sandbox_info) +char **setup_environ(struct sandbox_info_t *sandbox_info, bool interactive) { int have_ld_preload = 0; @@ -264,6 +264,7 @@ char **setup_environ(struct sandbox_info_t *sandbox_info) unsetenv(ENV_SANDBOX_MESSAGE_PATH); unsetenv(ENV_SANDBOX_WORKDIR); unsetenv(ENV_SANDBOX_ACTIVE); + unsetenv(ENV_SANDBOX_INTRACTV); unsetenv(ENV_BASH_ENV); orig_ld_preload_envvar = getenv(ENV_LD_PRELOAD); @@ -295,6 +296,9 @@ char **setup_environ(struct sandbox_info_t *sandbox_info) sb_setenv(&new_environ, ENV_SANDBOX_LOG, sandbox_info->sandbox_log); sb_setenv(&new_environ, ENV_SANDBOX_DEBUG_LOG, sandbox_info->sandbox_debug_log); sb_setenv(&new_environ, ENV_SANDBOX_MESSAGE_PATH, sandbox_info->sandbox_message_path); + /* Is this an interactive session? */ + if (interactive) + sb_setenv(&new_environ, ENV_SANDBOX_INTRACTV, "1"); /* Just set the these if not already set so that is_env_on() work */ if (!getenv(ENV_SANDBOX_VERBOSE)) sb_setenv(&new_environ, ENV_SANDBOX_VERBOSE, "1"); diff --git a/src/sandbox.c b/src/sandbox.c index ed0c7f6..063974d 100644 --- a/src/sandbox.c +++ b/src/sandbox.c @@ -255,7 +255,7 @@ int main(int argc, char **argv) /* Setup the child environment stuff. * XXX: We free this in spawn_shell(). */ - sandbox_environ = setup_environ(&sandbox_info); + sandbox_environ = setup_environ(&sandbox_info, print_debug); if (NULL == sandbox_environ) goto oom_error; diff --git a/src/sandbox.h b/src/sandbox.h index cdc1b9e..0c0430f 100644 --- a/src/sandbox.h +++ b/src/sandbox.h @@ -24,7 +24,7 @@ struct sandbox_info_t { char *home_dir; }; -extern char **setup_environ(struct sandbox_info_t *sandbox_info); +extern char **setup_environ(struct sandbox_info_t *sandbox_info, bool interactive); extern bool sb_get_cnf_bool(const char *, bool); -- cgit v1.2.3-65-gdbad