diff options
author | 2021-11-05 05:04:41 -0400 | |
---|---|---|
committer | 2021-11-05 05:04:41 -0400 | |
commit | 163a378b532c03c0199c489b6d829a84875e32c2 (patch) | |
tree | a6db16cdae7e9e79a1792ff03ff0255f9bca4e63 /src | |
parent | Force sandbox-internal functions to use 64bit file interface (diff) | |
download | sandbox-163a378b532c03c0199c489b6d829a84875e32c2.tar.gz sandbox-163a378b532c03c0199c489b6d829a84875e32c2.tar.bz2 sandbox-163a378b532c03c0199c489b6d829a84875e32c2.zip |
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 <vapier@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/environ.c | 6 | ||||
-rw-r--r-- | src/sandbox.c | 2 | ||||
-rw-r--r-- | src/sandbox.h | 2 |
3 files changed, 7 insertions, 3 deletions
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); |