aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firejail/main.c')
-rw-r--r--src/firejail/main.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c
index c262402fa..2a8ee3e0f 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -733,26 +733,30 @@ static void run_cmd_and_exit(int i, int argc, char **argv) {
733 else if (strncmp(argv[i], "--join-or-start=", 16) == 0) { 733 else if (strncmp(argv[i], "--join-or-start=", 16) == 0) {
734 // NOTE: this is first part of option handler, 734 // NOTE: this is first part of option handler,
735 // sandbox name is set in other part 735 // sandbox name is set in other part
736 logargs(argc, argv); 736 if (checkcfg(CFG_JOIN) || getuid() == 0) {
737 logargs(argc, argv);
737 738
738 if (arg_shell_none) { 739 if (arg_shell_none) {
739 if (argc <= (i+1)) { 740 if (argc <= (i+1)) {
740 fprintf(stderr, "Error: --shell=none set, but no command specified\n"); 741 fprintf(stderr, "Error: --shell=none set, but no command specified\n");
741 exit(1); 742 exit(1);
743 }
744 cfg.original_program_index = i + 1;
742 } 745 }
743 cfg.original_program_index = i + 1;
744 }
745 746
746 // try to join by name only 747 // try to join by name only
747 pid_t pid; 748 pid_t pid;
748 if (!read_pid(argv[i] + 16, &pid)) { 749 if (!read_pid(argv[i] + 16, &pid)) {
749 if (!cfg.shell && !arg_shell_none) 750 if (!cfg.shell && !arg_shell_none)
750 cfg.shell = guess_shell(); 751 cfg.shell = guess_shell();
751 752
752 join(pid, argc, argv, i + 1); 753 join(pid, argc, argv, i + 1);
753 exit(0); 754 exit(0);
755 }
756 // if there no such sandbox continue argument processing
754 } 757 }
755 // if there no such sandbox continue argument processing 758 else
759 exit_err_feature("join");
756 } 760 }
757#ifdef HAVE_NETWORK 761#ifdef HAVE_NETWORK
758 else if (strncmp(argv[i], "--join-network=", 15) == 0) { 762 else if (strncmp(argv[i], "--join-network=", 15) == 0) {