diff options
author | Heiko Hund <heiko.hund@sophos.com> | 2012-08-01 13:37:37 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2012-08-06 12:16:07 +0200 |
commit | 004ca97c9427841cc240f954d7594416cd249187 (patch) | |
tree | fc85236fc3cb72f0f8395d378580fd2dfdeb291c | |
parent | 4f879daeb9b1b709c80d01e4872b30e23747c4a8 (diff) | |
download | openvpn-004ca97c9427841cc240f954d7594416cd249187.tar.gz openvpn-004ca97c9427841cc240f954d7594416cd249187.tar.xz openvpn-004ca97c9427841cc240f954d7594416cd249187.zip |
add x_msg_va() log function
This change allows other functions to access the functionality in x_msg().
Needed for the plug-in logging API.
Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: David Sommerseth <davids@redhat.com>
Message-Id: 1343821058-11456-2-git-send-email-heiko.hund@sophos.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6923
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
-rw-r--r-- | src/openvpn/error.c | 11 | ||||
-rw-r--r-- | src/openvpn/error.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/openvpn/error.c b/src/openvpn/error.c index 8396fe0..6848425 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -201,8 +201,15 @@ int x_msg_line_num; /* GLOBAL */ void x_msg (const unsigned int flags, const char *format, ...) { - struct gc_arena gc; va_list arglist; + va_start (arglist, format); + x_msg_va (flags, format, arglist); + va_end (arglist); +} + +void x_msg_va (const unsigned int flags, const char *format, va_list arglist) +{ + struct gc_arena gc; #if SYSLOG_CAPABILITY int level; #endif @@ -237,9 +244,7 @@ void x_msg (const unsigned int flags, const char *format, ...) m1 = (char *) gc_malloc (ERR_BUF_SIZE, false, &gc); m2 = (char *) gc_malloc (ERR_BUF_SIZE, false, &gc); - va_start (arglist, format); vsnprintf (m1, ERR_BUF_SIZE, format, arglist); - va_end (arglist); m1[ERR_BUF_SIZE - 1] = 0; /* windows vsnprintf needs this */ if ((flags & M_ERRNO) && e) diff --git a/src/openvpn/error.h b/src/openvpn/error.h index aedb7c3..27c48b6 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -182,6 +182,8 @@ void x_msg (const unsigned int flags, const char *format, ...) #endif ; /* should be called via msg above */ +void x_msg_va (const unsigned int flags, const char *format, va_list arglist); + /* * Function prototypes */ |