diff --git a/src/firejail/checkcfg.c b/src/firejail/checkcfg.c index 6fc70318b5c..8f8f5b6c3d4 100644 --- a/src/firejail/checkcfg.c +++ b/src/firejail/checkcfg.c @@ -300,6 +300,12 @@ int checkcfg(int val) { exit(1); } +void print_version(void) { + printf("firejail version %s\n", VERSION); + printf("\n"); + print_compiletime_support(); + printf("\n"); +} void print_compiletime_support(void) { printf("Compile time support:\n"); diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index 316518534ea..de11b438df7 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h @@ -833,6 +833,7 @@ extern char *config_seccomp_filter_add; extern char **whitelist_reject_topdirs; int checkcfg(int val); +void print_version(void); void print_compiletime_support(void); // appimage.c diff --git a/src/firejail/main.c b/src/firejail/main.c index fd96f8bb58d..1d90b9fc5dc 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -356,10 +356,7 @@ static void run_cmd_and_exit(int i, int argc, char **argv) { exit(0); } else if (strcmp(argv[i], "--version") == 0) { - printf("firejail version %s\n", VERSION); - printf("\n"); - print_compiletime_support(); - printf("\n"); + print_version(); exit(0); } #ifdef HAVE_OVERLAYFS @@ -1082,7 +1079,7 @@ int main(int argc, char **argv, char **envp) { EUID_USER(); if (rv == 0) { if (check_arg(argc, argv, "--version", 1)) { - printf("firejail version %s\n", VERSION); + print_version(); exit(0); }