aboutsummaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2010-07-27 21:46:34 +0000
committerJames Yonan <james@openvpn.net>2010-07-27 21:46:34 +0000
commit75dfe3d7f73279ddefb533f2e3b4a4cce4e9802a (patch)
tree817f286a4c36cf37c1f05547b22260f5ff5518fd /error.c
parentFixed an issue where application payload transmissions on the (diff)
downloadopenvpn-75dfe3d7f73279ddefb533f2e3b4a4cce4e9802a.tar.xz
Added "net stop dnscache" and "net start dnscache" in front
of existing --register-dns commands. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@6352 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r--error.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/error.c b/error.c
index ec8f9df..873718c 100644
--- a/error.c
+++ b/error.c
@@ -477,14 +477,16 @@ redirect_stdout_stderr (const char *file, bool append)
{
HANDLE log_handle;
int log_fd;
- struct security_attributes sa;
- init_security_attributes_allow_all (&sa);
+ SECURITY_ATTRIBUTES saAttr;
+ saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ saAttr.bInheritHandle = TRUE;
+ saAttr.lpSecurityDescriptor = NULL;
log_handle = CreateFile (file,
GENERIC_WRITE,
FILE_SHARE_READ,
- &sa.sa,
+ &saAttr,
append ? OPEN_ALWAYS : CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
@@ -505,10 +507,12 @@ redirect_stdout_stderr (const char *file, bool append)
/* save original stderr for password prompts */
orig_stderr = GetStdHandle (STD_ERROR_HANDLE);
+#if 0 /* seems not be necessary with stdout/stderr redirection below*/
/* set up for redirection */
if (!SetStdHandle (STD_OUTPUT_HANDLE, log_handle)
|| !SetStdHandle (STD_ERROR_HANDLE, log_handle))
msg (M_ERR, "Error: cannot redirect stdout/stderr to --log file: %s", file);
+#endif
/* direct stdout/stderr to point to log_handle */
log_fd = _open_osfhandle ((intptr_t)log_handle, _O_TEXT);