From 4dd5b3d90e962d5fd1794f97a8f82077f8f1eb36 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Thu, 14 Nov 2024 21:20:49 +0100 Subject: [PATCH] Logging: exposing vlog() to log va_lists --- client/util.c | 6 +++--- lib/birdlib.h | 2 ++ sysdep/unix/log.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/util.c b/client/util.c index 1d83e518..3a78a7c4 100644 --- a/client/util.c +++ b/client/util.c @@ -17,7 +17,7 @@ /* Client versions of logging functions */ static void -vlog(const char *msg, va_list args) +vlog_cli(const char *msg, va_list args) { char buf[1024]; @@ -38,7 +38,7 @@ bug(const char *msg, ...) va_start(args, msg); cleanup(); fputs("Internal error: ", stderr); - vlog(msg, args); + vlog_cli(msg, args); vfprintf(stderr, msg, args); va_end(args); exit(1); @@ -51,7 +51,7 @@ die(const char *msg, ...) va_start(args, msg); cleanup(); - vlog(msg, args); + vlog_cli(msg, args); va_end(args); exit(1); } diff --git a/lib/birdlib.h b/lib/birdlib.h index 8852b609..4fea3f9f 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -10,6 +10,7 @@ #define _BIRD_BIRDLIB_H_ #include "lib/alloca.h" +#include /* Ugly structure offset handling macros */ @@ -159,6 +160,7 @@ void log_msg(const char *msg, ...); void log_rl(struct tbf *rl, const char *msg, ...); void die(const char *msg, ...) NORET; void bug(const char *msg, ...) NORET; +void vlog(int class, const char *msg, va_list args); #define L_DEBUG "\001" /* Debugging messages */ #define L_TRACE "\002" /* Protocol tracing */ diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 613a6aa5..6c7cac54 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -274,7 +274,7 @@ log_commit(int class, buffer *buf) int buffer_vprint(buffer *buf, const char *fmt, va_list args); -static void +void vlog(int class, const char *msg, va_list args) { buffer buf;