aboutsummaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-07-28 11:22:51 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-07-28 11:22:51 +0200
commit328500c490c36c679e275dbf99c2820f58bcbaa3 (patch)
tree8e4fb0f8504c28d8d27aaa24618895bf09d6a439 /error.c
parentSolved hidden merge conflict between feat_misc and bugfix2.1 (diff)
parentAdded "net stop dnscache" and "net start dnscache" in front (diff)
downloadopenvpn-328500c490c36c679e275dbf99c2820f58bcbaa3.tar.xz
Merge branch 'svn-BETA21' into beta2.2
Conflicts: openvpn.8 - Enhancements to the --register-dns description ssl.h - Community changed n_packets and n_bytes to use counter_type instead of int to avoid integer overflows (commit 6484c6299cf298107316e6497) Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'error.c')
-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);