randpktdump: Initialize print error handler

When there is a problem with output pipe, randpktdump will call
cfile_write_failure_message() which in turn calls cmdarg_err() which
calls print_err. Call cmdarg_err_init() so print_err is not NULL.

Change-Id: Ie459596a473c83204e9aa1d48bb2d2d3717b340a
Reviewed-on: https://code.wireshark.org/review/34495
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Tomasz Moń 2019-09-10 19:53:18 +02:00 committed by Michael Mann
parent c0224eeeb8
commit 4853fb93b2
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <wsutil/please_report_bug.h>
#include <cli_main.h>
#include <ui/cmdarg_err.h>
#define RANDPKT_EXTCAP_INTERFACE "randpkt"
#define RANDPKTDUMP_VERSION_MAJOR "0"
@ -124,6 +125,11 @@ static int list_config(char *interface)
return EXIT_SUCCESS;
}
static void failure_warning_message(const char *msg_format, va_list ap)
{
g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, msg_format, ap);
}
int main(int argc, char *argv[])
{
char* err_msg;
@ -144,6 +150,8 @@ int main(int argc, char *argv[])
char* help_url;
char* help_header = NULL;
cmdarg_err_init(failure_warning_message, failure_warning_message);
/*
* Get credential information for later use.
*/