aboutsummaryrefslogtreecommitdiffstats
path: root/text2pcap.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-06-24 21:20:25 +0100
committerJoão Valverde <j@v6e.pt>2021-06-26 00:18:26 +0100
commitc6a920686ce59ea8b29f7a61f8197077baedf304 (patch)
treeda6268c7e6fce9e38f99190f08fe3c08b5301b38 /text2pcap.c
parentc2c256f0d8afa76599d7c3f3dcfac23c02069209 (diff)
wslog: Check environment initialization for errors
Initialiaze the cmdarg error stream earlier. Dumpcap also needs to know earlier if it is running in capture child mode.
Diffstat (limited to 'text2pcap.c')
-rw-r--r--text2pcap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/text2pcap.c b/text2pcap.c
index 6c7cbc70b5..9037e29031 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -1860,13 +1860,23 @@ parse_options (int argc, char *argv[])
return EXIT_SUCCESS;
}
+void
+text2pcap_vcmdarg_err(const char *fmt, va_list ap)
+{
+ vfprintf(stderr, fmt, ap);
+ fputc('\n', stderr);
+}
+
int
main(int argc, char *argv[])
{
int ret = EXIT_SUCCESS;
/* Initialize log handler early so we can have proper logging during startup. */
- ws_log_init("text2pcap", NULL);
+ ws_log_init("text2pcap", text2pcap_vcmdarg_err);
+
+ /* Early logging command-line initialization. */
+ ws_log_parse_args(&argc, argv, text2pcap_vcmdarg_err, 1);
#ifdef _WIN32
create_app_running_mutex();