From cdec68ef917c9c55e37f27680c23db1e8a993e3d Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Sat, 13 Feb 2016 22:34:25 -0500 Subject: [PATCH] Put --log first in the command line This is needed to avoid early messages going to stdout leaving no trace of errors when openvpn exits before management interface is up. It also ensures that any --log directives in the config do not override the log file location. Signed-off-by: Selva Nair --- openvpn.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openvpn.c b/openvpn.c index 7ccf45f..e8cc180 100644 --- a/openvpn.c +++ b/openvpn.c @@ -682,12 +682,13 @@ StartOpenVPN(connection_t *c) /* Create a management interface password */ GetRandomPassword(c->manage.password, sizeof(c->manage.password) - 1); - /* Construct command line */ - _sntprintf_0(cmdline, _T("openvpn --config \"%s\" " - "--setenv IV_GUI_VER \"%S\" --service %s 0 --log%s \"%s\" --auth-retry interact " + /* Construct command line -- put log first */ + _sntprintf_0(cmdline, _T("openvpn --log%s \"%s\" --config \"%s\" " + "--setenv IV_GUI_VER \"%S\" --service %s 0 --auth-retry interact " "--management %S %hd stdin --management-query-passwords %s" - "--management-hold"), c->config_file, PACKAGE_STRING, exit_event_name, + "--management-hold"), (o.append_string[0] == '1' ? _T("-append") : _T("")), c->log_path, + c->config_file, PACKAGE_STRING, exit_event_name, inet_ntoa(c->manage.skaddr.sin_addr), ntohs(c->manage.skaddr.sin_port), (o.proxy_source != config ? _T("--management-query-proxy ") : _T("")));