aboutsummaryrefslogtreecommitdiffstats
path: root/mergecap.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 /mergecap.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 'mergecap.c')
-rw-r--r--mergecap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mergecap.c b/mergecap.c
index cee3834d69..5c670a2f00 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -42,6 +42,7 @@
#include <wsutil/privileges.h>
#include <wsutil/strnatcmp.h>
#include <wsutil/ws_assert.h>
+#include <wsutil/wslog.h>
#include <cli_main.h>
#include <version_info.h>
@@ -227,8 +228,14 @@ main(int argc, char *argv[])
idb_merge_mode mode = IDB_MERGE_MODE_MAX;
merge_progress_callback_t cb;
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("mergecap", NULL);
+
cmdarg_err_init(mergecap_cmdarg_err, mergecap_cmdarg_err_cont);
+ /* Early logging command-line initialization. */
+ ws_log_parse_args(&argc, argv, vcmdarg_err, 1);
+
#ifdef _WIN32
create_app_running_mutex();
#endif /* _WIN32 */