aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/no_sandbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firejail/no_sandbox.c')
-rw-r--r--src/firejail/no_sandbox.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/firejail/no_sandbox.c b/src/firejail/no_sandbox.c
index 090c06761..f7d62f90c 100644
--- a/src/firejail/no_sandbox.c
+++ b/src/firejail/no_sandbox.c
@@ -237,7 +237,7 @@ void run_no_sandbox(int argc, char **argv) {
237 } 237 }
238 // guess shell otherwise 238 // guess shell otherwise
239 if (!arg_shell_none && !cfg.shell) { 239 if (!arg_shell_none && !cfg.shell) {
240 guess_shell(); 240 cfg.shell = guess_shell();
241 if (arg_debug) 241 if (arg_debug)
242 printf("Autoselecting %s as shell\n", cfg.shell); 242 printf("Autoselecting %s as shell\n", cfg.shell);
243 } 243 }
@@ -247,8 +247,19 @@ void run_no_sandbox(int argc, char **argv) {
247 } 247 }
248 248
249 int prog_index = 0; 249 int prog_index = 0;
250 // find first non option arg 250 // find first non option arg:
251 // - first argument not starting wiht --,
252 // - whatever follows after -c (example: firejail -c ls)
251 for (i = 1; i < argc; i++) { 253 for (i = 1; i < argc; i++) {
254 if (strcmp(argv[i], "-c") == 0) {
255 prog_index = i + 1;
256 if (prog_index == argc) {
257 fprintf(stderr, "Error: option -c requires an argument\n");
258 exit(1);
259 }
260 break;
261 }
262 // check first argument not starting with --
252 if (strncmp(argv[i],"--",2) != 0) { 263 if (strncmp(argv[i],"--",2) != 0) {
253 prog_index = i; 264 prog_index = i;
254 break; 265 break;