aboutsummaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-16 18:12:24 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-16 18:12:24 +0000
commit6add6b2fe78c549d174729869e26cee917e31d5f (patch)
tree7b0786b12c40853bd9742d61e07417ade430f3d2 /error.c
parentAdded "bytecount" command to management interface. (diff)
downloadopenvpn-6add6b2fe78c549d174729869e26cee917e31d5f.tar.xz
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
Diffstat (limited to '')
-rw-r--r--error.c40
1 files changed, 28 insertions, 12 deletions
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 <openssl/err.h>
@@ -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 ();