diff options
Diffstat (limited to 'src/firejail/main.c')
-rw-r--r-- | src/firejail/main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index 545c38018..b25bad9f2 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -774,7 +774,7 @@ static int check_arg(int argc, char **argv, const char *argument) { | |||
774 | int i; | 774 | int i; |
775 | int found = 0; | 775 | int found = 0; |
776 | for (i = 1; i < argc; i++) { | 776 | for (i = 1; i < argc; i++) { |
777 | if (strcmp(argv[i], "--force") == 0) { | 777 | if (strcmp(argv[i], argument) == 0) { |
778 | found = 1; | 778 | found = 1; |
779 | break; | 779 | break; |
780 | } | 780 | } |
@@ -833,6 +833,11 @@ int main(int argc, char **argv) { | |||
833 | if (check_arg(argc, argv, "--force")) | 833 | if (check_arg(argc, argv, "--force")) |
834 | option_force = 1; | 834 | option_force = 1; |
835 | else { | 835 | else { |
836 | if (check_arg(argc, argv, "--version")) { | ||
837 | printf("firejail version %s\n", VERSION); | ||
838 | exit(0); | ||
839 | } | ||
840 | |||
836 | // start the program directly without sandboxing | 841 | // start the program directly without sandboxing |
837 | run_no_sandbox(argc, argv); | 842 | run_no_sandbox(argc, argv); |
838 | // it will never get here! | 843 | // it will never get here! |
@@ -840,12 +845,12 @@ int main(int argc, char **argv) { | |||
840 | } | 845 | } |
841 | } | 846 | } |
842 | } | 847 | } |
843 | 848 | ||
844 | // check root/suid | 849 | // check root/suid |
845 | EUID_ROOT(); | 850 | EUID_ROOT(); |
846 | if (geteuid()) { | 851 | if (geteuid()) { |
847 | // only --version is supported without SUID support | 852 | // only --version is supported without SUID support |
848 | if (check_arg(argc, argv, "--force")) { | 853 | if (check_arg(argc, argv, "--version")) { |
849 | printf("firejail version %s\n", VERSION); | 854 | printf("firejail version %s\n", VERSION); |
850 | exit(0); | 855 | exit(0); |
851 | } | 856 | } |