aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.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 /dumpcap.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 'dumpcap.c')
-rw-r--r--dumpcap.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 539ed003de..c5512aa5b5 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4851,17 +4851,13 @@ main(int argc, char *argv[])
#endif
GString *str;
- g_set_prgname("dumpcap");
-
/* Initialize log handler early so we can have proper logging during startup. */
- ws_log_init(dumpcap_log_writer);
+ ws_log_init("dumpcap", dumpcap_log_writer);
cmdarg_err_init(dumpcap_cmdarg_err, dumpcap_cmdarg_err_cont);
- /* Command line options are parsed too late to configure logging, do it
- manually. */
- if (ws_log_parse_args(&argc, argv, cmdarg_err) != 0)
- exit(1);
+ /* Early logging command-line initialization. */
+ ws_log_parse_args(&argc, argv, vcmdarg_err, 1);
#ifdef _WIN32
create_app_running_mutex();