aboutsummaryrefslogtreecommitdiffstats
path: root/extcap
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 /extcap
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 'extcap')
-rw-r--r--extcap/androiddump.c10
-rw-r--r--extcap/ciscodump.c3
-rw-r--r--extcap/dpauxmon.c3
-rw-r--r--extcap/etwdump.c3
-rw-r--r--extcap/randpktdump.c10
-rw-r--r--extcap/sdjournal.c3
-rw-r--r--extcap/sshdump.c3
-rw-r--r--extcap/udpdump.c3
8 files changed, 24 insertions, 14 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index afd13c1c4a..7cf52e452f 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -2528,17 +2528,13 @@ int main(int argc, char *argv[]) {
char *help_url;
char *help_header = NULL;
- g_set_prgname("androiddump");
-
/* Initialize log handler early so we can have proper logging during startup. */
- ws_log_init(NULL);
+ ws_log_init("androiddump", NULL);
cmdarg_err_init(androiddump_cmdarg_err, androiddump_cmdarg_err);
- /* Command line options are parsed too late to configure logging, do it
- manually. */
- if (ws_log_parse_args(&argc, argv, cmdarg_err) != 0)
- return EXIT_FAILURE;
+ /* Early logging command-line initialization. */
+ ws_log_parse_args(&argc, argv, vcmdarg_err, EXIT_FAILURE);
/*
* Get credential information for later use.
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c
index 80f8cc5418..217fd838d8 100644
--- a/extcap/ciscodump.c
+++ b/extcap/ciscodump.c
@@ -534,6 +534,9 @@ int main(int argc, char *argv[])
char* help_url;
char* help_header = NULL;
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("ciscodump", NULL);
+
/*
* Get credential information for later use.
*/
diff --git a/extcap/dpauxmon.c b/extcap/dpauxmon.c
index f3bed612d9..98c6b1319d 100644
--- a/extcap/dpauxmon.c
+++ b/extcap/dpauxmon.c
@@ -489,6 +489,9 @@ int main(int argc, char *argv[])
extcap_parameters* extcap_conf = g_new0(extcap_parameters, 1);
char* help_header = NULL;
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("dpauxmon", NULL);
+
/*
* Get credential information for later use.
*/
diff --git a/extcap/etwdump.c b/extcap/etwdump.c
index bc8fb3b04e..9d6d8fa7ae 100644
--- a/extcap/etwdump.c
+++ b/extcap/etwdump.c
@@ -122,6 +122,9 @@ int main(int argc, char* argv[])
char* help_url;
char* help_header = NULL;
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("etwdump", NULL);
+
/*
* Get credential information for later use.
*/
diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c
index 1b7e3dec1b..f1f18cd19e 100644
--- a/extcap/randpktdump.c
+++ b/extcap/randpktdump.c
@@ -151,17 +151,13 @@ int main(int argc, char *argv[])
char* help_url;
char* help_header = NULL;
- g_set_prgname("randpktdump");
-
/* Initialize log handler early so we can have proper logging during startup. */
- ws_log_init(NULL);
+ ws_log_init("randpktdump", NULL);
cmdarg_err_init(randpktdump_cmdarg_err, randpktdump_cmdarg_err);
- /* Command line options are parsed too late to configure logging, do it
- manually. */
- if (ws_log_parse_args(&argc, argv, cmdarg_err) != 0)
- return EXIT_FAILURE;
+ /* Early logging command-line initialization. */
+ ws_log_parse_args(&argc, argv, vcmdarg_err, EXIT_FAILURE);
/*
* Get credential information for later use.
diff --git a/extcap/sdjournal.c b/extcap/sdjournal.c
index 1e1629cb12..71b163b470 100644
--- a/extcap/sdjournal.c
+++ b/extcap/sdjournal.c
@@ -341,6 +341,9 @@ int main(int argc, char **argv)
char* help_url;
char* help_header = NULL;
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("sdjournal", NULL);
+
/*
* Get credential information for later use.
*/
diff --git a/extcap/sshdump.c b/extcap/sshdump.c
index ae202fb22f..80bab13f79 100644
--- a/extcap/sshdump.c
+++ b/extcap/sshdump.c
@@ -362,6 +362,9 @@ int main(int argc, char *argv[])
gboolean noprom = FALSE;
gchar* interface_description = g_strdup("SSH remote capture");
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("sshdump", NULL);
+
sshdump_extcap_interface = g_path_get_basename(argv[0]);
/*
diff --git a/extcap/udpdump.c b/extcap/udpdump.c
index ba606dda5c..44361e17c5 100644
--- a/extcap/udpdump.c
+++ b/extcap/udpdump.c
@@ -368,6 +368,9 @@ int main(int argc, char *argv[])
char* payload = NULL;
char* port_msg = NULL;
+ /* Initialize log handler early so we can have proper logging during startup. */
+ ws_log_init("udpdump", NULL);
+
/*
* Get credential information for later use.
*/