diff options
author | 2020-12-22 17:14:41 +0100 | |
---|---|---|
committer | 2020-12-22 17:14:41 +0100 | |
commit | 91588630ebe436e0586c6234ffda518ebd8501aa (patch) | |
tree | f69226b1d9b522409100bc08a6ecf49ed8366f5d | |
parent | noroot option: create mapping of firejail group (diff) | |
download | firejail-91588630ebe436e0586c6234ffda518ebd8501aa.tar.gz firejail-91588630ebe436e0586c6234ffda518ebd8501aa.tar.zst firejail-91588630ebe436e0586c6234ffda518ebd8501aa.zip |
rework previous commit 45c28b808df9529aca32fdd755ac14e8101af3c1
-rw-r--r-- | src/firejail/main.c | 13 | ||||
-rw-r--r-- | src/firejail/no_sandbox.c | 1 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index babeac1ef..544bfe83a 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -864,13 +864,12 @@ char *guess_shell(void) { | |||
864 | char *shell = NULL; | 864 | char *shell = NULL; |
865 | struct stat s; | 865 | struct stat s; |
866 | 866 | ||
867 | if (!login_shell) { // if firejail is the login shell, SHELL is set to path of firejail executable | 867 | shell = getenv("SHELL"); |
868 | shell = getenv("SHELL"); | 868 | if (shell) { |
869 | if (shell) { | 869 | invalid_filename(shell, 0); // no globbing |
870 | invalid_filename(shell, 0); // no globbing | 870 | if (!is_dir(shell) && strstr(shell, "..") == NULL && stat(shell, &s) == 0 && access(shell, X_OK) == 0 && |
871 | if (!is_dir(shell) && strstr(shell, "..") == NULL && stat(shell, &s) == 0 && access(shell, X_OK) == 0) | 871 | strcmp(shell, PATH_FIREJAIL) != 0) |
872 | return shell; | 872 | return shell; |
873 | } | ||
874 | } | 873 | } |
875 | 874 | ||
876 | // shells in order of preference | 875 | // shells in order of preference |
diff --git a/src/firejail/no_sandbox.c b/src/firejail/no_sandbox.c index 6d01d443a..ef0af1491 100644 --- a/src/firejail/no_sandbox.c +++ b/src/firejail/no_sandbox.c | |||
@@ -178,7 +178,6 @@ void run_no_sandbox(int argc, char **argv) { | |||
178 | 178 | ||
179 | // use $SHELL to get shell used in sandbox, guess shell otherwise | 179 | // use $SHELL to get shell used in sandbox, guess shell otherwise |
180 | assert(login_shell == 0); | 180 | assert(login_shell == 0); |
181 | cfg.shell = guess_shell(); | ||
182 | if (!cfg.shell) { | 181 | if (!cfg.shell) { |
183 | fprintf(stderr, "Error: unable to guess your shell, please set SHELL environment variable\n"); | 182 | fprintf(stderr, "Error: unable to guess your shell, please set SHELL environment variable\n"); |
184 | exit(1); | 183 | exit(1); |