aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-05-11 21:02:46 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-05-14 16:58:38 -0300
commitf019f0ec3fd807676855c99f11dd2fcebfc1da27 (patch)
tree33c496e8d8cf5c05946217f999031b18e9b6a312 /src
parentMove usage text into usage_str var (diff)
downloadfirejail-f019f0ec3.tar.gz
firejail-f019f0ec3.tar.zst
firejail-f019f0ec3.zip
Print version on startup for firejail/firecfg
It is not too uncommon for the firejail version to be missing when issues are reported; this commit makes it more likely that any posted logs will contain the program version. Do so just for firejail and firecfg for now because they are the most common user-facing programs. Print the version after argument parsing, in order to avoid printing the program version more than once and to avoid interfering with commands that generate machine-readable output (like `firejail --list` and `firecfg --list`). Also, only print it after all profiles have been loaded, because a profile may contain `quiet`. Note: This does not cover the case where the program exits before the end of argument/profile parsing (such as when an error occurs).
Diffstat (limited to 'src')
-rw-r--r--src/firecfg/main.c1
-rw-r--r--src/firejail/main.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/firecfg/main.c b/src/firecfg/main.c
index aadc93579..da962c35d 100644
--- a/src/firecfg/main.c
+++ b/src/firecfg/main.c
@@ -413,6 +413,7 @@ int main(int argc, char **argv) {
413 } 413 }
414 } 414 }
415 415
416 print_version();
416 if (arg_debug) 417 if (arg_debug)
417 printf("%s %d %d %d %d\n", user, getuid(), getgid(), geteuid(), getegid()); 418 printf("%s %d %d %d %d\n", user, getuid(), getgid(), geteuid(), getegid());
418 419
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 6bb63d26f..1835d8de2 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -3010,6 +3010,11 @@ int main(int argc, char **argv, char **envp) {
3010 } 3010 }
3011 EUID_ASSERT(); 3011 EUID_ASSERT();
3012 3012
3013 // Note: Only attempt to print non-debug information to stdout after
3014 // all profiles have been loaded (because a profile may set arg_quiet)
3015 if (!arg_quiet)
3016 print_version();
3017
3013 // block X11 sockets 3018 // block X11 sockets
3014 if (arg_x11_block) 3019 if (arg_x11_block)
3015 x11_block(); 3020 x11_block();