diff options
author | João Valverde <j@v6e.pt> | 2022-09-27 22:05:55 +0100 |
---|---|---|
committer | A Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2022-09-28 14:56:16 +0000 |
commit | ad66a854a0910ef4366acdcd61a3ba7d402808a0 (patch) | |
tree | d657b11cf56b71fff8b2caf3de06a69b8bfaf4e8 /wsutil | |
parent | 32befe119d2dc186abc5ffd9eef6108287eca6b8 (diff) |
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.
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/wslog.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/wsutil/wslog.c b/wsutil/wslog.c index a6482e6e7c..bbb9a8c189 100644 --- a/wsutil/wslog.c +++ b/wsutil/wslog.c @@ -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); |