From f019f0ec3fd807676855c99f11dd2fcebfc1da27 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Thu, 11 May 2023 21:02:46 -0300 Subject: 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). --- src/firecfg/main.c | 1 + src/firejail/main.c | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'src') 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) { } } + print_version(); if (arg_debug) printf("%s %d %d %d %d\n", user, getuid(), getgid(), geteuid(), getegid()); 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) { } EUID_ASSERT(); + // Note: Only attempt to print non-debug information to stdout after + // all profiles have been loaded (because a profile may set arg_quiet) + if (!arg_quiet) + print_version(); + // block X11 sockets if (arg_x11_block) x11_block(); -- cgit v1.2.3-54-g00ecf