diff options
author | 2016-08-15 01:18:04 +0200 | |
---|---|---|
committer | 2016-08-15 01:18:04 +0200 | |
commit | 2e43a1143044fb6e7fb337975bfae4d6b8724940 (patch) | |
tree | aedde22a9336d3dd6f0f9512f28f8bbd6994cfe2 /src | |
parent | Merge pull request #713 from i-MSCP/master (diff) | |
download | firejail-2e43a1143044fb6e7fb337975bfae4d6b8724940.tar.gz firejail-2e43a1143044fb6e7fb337975bfae4d6b8724940.tar.zst firejail-2e43a1143044fb6e7fb337975bfae4d6b8724940.zip |
Fixes remaining issues related to #704
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/sandbox.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 3e8b5f934..6b3d5ea89 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -326,22 +326,26 @@ static void start_application(void) { | |||
326 | //**************************************** | 326 | //**************************************** |
327 | else { | 327 | else { |
328 | assert(cfg.shell); | 328 | assert(cfg.shell); |
329 | assert(cfg.command_line); | ||
329 | 330 | ||
330 | char *arg[6]; | 331 | char *arg[5]; |
331 | int index = 0; | 332 | int index = 0; |
332 | arg[index++] = cfg.shell; | 333 | arg[index++] = cfg.shell; |
333 | if (login_shell) | 334 | if (login_shell && cfg.shell == cfg.command_line) { |
334 | arg[index++] = "-l"; | 335 | arg[index++] = "-l"; |
335 | arg[index++] = "-c"; | 336 | if (arg_debug) |
336 | assert(cfg.command_line); | 337 | printf("Starting %s login shell\n", cfg.shell); |
337 | if (arg_debug) | 338 | } else { |
338 | printf("Starting %s\n", cfg.command_line); | 339 | arg[index++] = "-c"; |
339 | if (arg_doubledash) | 340 | if (arg_debug) |
340 | arg[index++] = "--"; | 341 | printf("Running %s command through %s\n", cfg.command_line, cfg.shell); |
341 | arg[index++] = cfg.command_line; | 342 | if (arg_doubledash) |
343 | arg[index++] = "--"; | ||
344 | arg[index++] = cfg.command_line; | ||
345 | } | ||
342 | arg[index] = NULL; | 346 | arg[index] = NULL; |
343 | assert(index < 5); | 347 | assert(index < 5); |
344 | 348 | ||
345 | if (arg_debug) { | 349 | if (arg_debug) { |
346 | char *msg; | 350 | char *msg; |
347 | if (asprintf(&msg, "sandbox %d, execvp into %s", sandbox_pid, cfg.command_line) == -1) | 351 | if (asprintf(&msg, "sandbox %d, execvp into %s", sandbox_pid, cfg.command_line) == -1) |
@@ -349,7 +353,7 @@ static void start_application(void) { | |||
349 | logmsg(msg); | 353 | logmsg(msg); |
350 | free(msg); | 354 | free(msg); |
351 | } | 355 | } |
352 | 356 | ||
353 | if (arg_debug) { | 357 | if (arg_debug) { |
354 | int i; | 358 | int i; |
355 | for (i = 0; i < 5; i++) { | 359 | for (i = 0; i < 5; i++) { |
@@ -358,12 +362,12 @@ static void start_application(void) { | |||
358 | printf("execvp argument %d: %s\n", i, arg[i]); | 362 | printf("execvp argument %d: %s\n", i, arg[i]); |
359 | } | 363 | } |
360 | } | 364 | } |
361 | 365 | ||
362 | if (!arg_command && !arg_quiet) | 366 | if (!arg_command && !arg_quiet) |
363 | printf("Child process initialized\n"); | 367 | printf("Child process initialized\n"); |
364 | execvp(arg[0], arg); | 368 | execvp(arg[0], arg); |
365 | } | 369 | } |
366 | 370 | ||
367 | perror("execvp"); | 371 | perror("execvp"); |
368 | exit(1); // it should never get here!!! | 372 | exit(1); // it should never get here!!! |
369 | } | 373 | } |