From 6add6b2fe78c549d174729869e26cee917e31d5f Mon Sep 17 00:00:00 2001 From: james Date: Thu, 16 Feb 2006 18:12:24 +0000 Subject: Added --port-share option for allowing OpenVPN and HTTPS server to share the same port number. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@893 e7ae566f-a301-0410-adde-c780ea21d3b5 --- error.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 6191cb3..de23b3d 100644 --- a/error.c +++ b/error.c @@ -41,6 +41,7 @@ #include "perf.h" #include "status.h" #include "integer.h" +#include "ps.h" #ifdef USE_CRYPTO #include @@ -88,6 +89,15 @@ static char *pgmname_syslog; /* GLOBAL */ /* If non-null, messages should be written here (used for debugging only) */ static FILE *msgfp; /* GLOBAL */ +/* If true, we forked from main OpenVPN process */ +static bool forked; /* GLOBAL */ + +void +msg_forked (void) +{ + forked = true; +} + bool set_debug_level (const int level, const unsigned int flags) { @@ -270,21 +280,22 @@ void x_msg (const unsigned int flags, const char *format, ...) prefix_sep = prefix = ""; /* virtual output capability used to copy output to management subsystem */ - { - const struct virtual_output *vo = msg_get_virtual_output (); - if (vo) - { - openvpn_snprintf (m2, ERR_BUF_SIZE, "%s%s%s", - prefix, - prefix_sep, - m1); - virtual_output_print (vo, flags, m2); - } - } + if (!forked) + { + const struct virtual_output *vo = msg_get_virtual_output (); + if (vo) + { + openvpn_snprintf (m2, ERR_BUF_SIZE, "%s%s%s", + prefix, + prefix_sep, + m1); + virtual_output_print (vo, flags, m2); + } + } if (!(flags & M_MSG_VIRT_OUT)) { - if (use_syslog && !std_redir) + if (use_syslog && !std_redir && !forked) { #if SYSLOG_CAPABILITY syslog (level, "%s%s%s", @@ -674,6 +685,11 @@ openvpn_exit (const int status) plugin_abort (); #endif +#if PORT_SHARE + if (port_share) + port_share_abort (port_share); +#endif + #ifdef ABORT_ON_ERROR if (status == OPENVPN_EXIT_STATUS_ERROR) abort (); -- cgit