wslog: Print to stderr with a null error handler

For some programs (e.g: unit tests) we want to init the logging
subsystem but having to pass an error output handler is overkill
and annoying.

In that case with a NULL handler printing to stderr by default is
almost certainly the best thing to do.
This commit is contained in:
João Valverde 2022-09-27 22:05:55 +01:00 committed by A Wireshark GitLab Utility
parent 32befe119d
commit ad66a854a0
1 changed files with 4 additions and 4 deletions

View File

@ -323,11 +323,11 @@ static void print_err(void (*vcmdarg_err)(const char *, va_list ap),
{
va_list ap;
if (vcmdarg_err == NULL)
return;
va_start(ap, fmt);
vcmdarg_err(fmt, ap);
if (vcmdarg_err)
vcmdarg_err(fmt, ap);
else
vfprintf(stderr, fmt, ap);
va_end(ap);
if (exit_failure != LOG_ARGS_NOEXIT)
exit(exit_failure);