aboutsummaryrefslogtreecommitdiffstats
path: root/shell.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-09-22 20:22:27 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commite8ce775db824de329b81293b4e5d8fbd65624528 (patch)
tree4b20c4dc766f5172b65ca1bc16ae1b6d48920fa1 /shell.c
parentd166f048818e10cf3799aa24a174fb22835f1acc (diff)
downloadandroid_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.gz
android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.bz2
android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.zip
Imported from ../bash-2.01.1.tar.gz.
Diffstat (limited to 'shell.c')
-rw-r--r--shell.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/shell.c b/shell.c
index 1ec100c..4870f80 100644
--- a/shell.c
+++ b/shell.c
@@ -248,7 +248,7 @@ main (argc, argv, env)
char **argv, **env;
{
register int i;
- int code;
+ int code, saverst;
volatile int locally_skip_execution;
volatile int arg_index, top_level_arg_index;
@@ -459,6 +459,13 @@ main (argc, argv, env)
interactive = 1;
}
+#if defined (RESTRICTED_SHELL)
+ /* If the `-r' option is supplied at invocation, make sure that the shell
+ is not in restricted mode when running the startup files. */
+ saverst = restricted;
+ restricted = 0;
+#endif
+
if (locally_skip_execution == 0 && running_setuid == 0)
run_startup_files ();
@@ -473,7 +480,10 @@ main (argc, argv, env)
}
#if defined (RESTRICTED_SHELL)
- /* Turn on the restrictions after parsing the startup files. */
+ /* Turn on the restrictions after parsing the startup files. This
+ means that `bash -r' or `set -r' invoked from a startup file will
+ turn on the restrictions after the startup files are executed. */
+ restricted = saverst || restricted;
maybe_make_restricted (shell_name);
#endif /* RESTRICTED_SHELL */