aboutsummaryrefslogtreecommitdiffstats
path: root/capinfos.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-06-19 19:44:58 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-06-21 16:03:29 +0000
commit759bb234d0eb4d36947213fca2bc14e386c1cc8f (patch)
treeec9ba564273b0d0db43bd1d9691feee79d4a41d1 /capinfos.c
parentc216bb85e75e3db7050f937d6925ba85fb3e6803 (diff)
wslog: Check if we are initialized and add missing inits
Instead of receiving the program name from GLib, pass it explicitly to ws_log_init() instead and use that to initialize the GLib program name. ws_log_parse_args() will now exit the program when it encounters an argument error if exit_failure >= 0.
Diffstat (limited to 'capinfos.c')
-rw-r--r--capinfos.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/capinfos.c b/capinfos.c
index c81decd36f..015e0c1e64 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -84,6 +84,7 @@
#include <wsutil/str_util.h>
#include <wsutil/file_util.h>
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#include <wsutil/wsgcrypt.h>
@@ -1580,8 +1581,15 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
#endif
+
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("capinfos", NULL);
+
cmdarg_err_init(capinfos_cmdarg_err, capinfos_cmdarg_err_cont);
+ /* Early logging command-line initialization. */
+ ws_log_parse_args(&argc, argv, vcmdarg_err, INVALID_OPTION);
+
/* Get the decimal point. */
decimal_point = g_strdup(localeconv()->decimal_point);