mirror of
https://github.com/OpenVPN/openvpn.git
synced 2025-05-08 21:25:53 +08:00
Open log files as text files on Windows
By giving the "t" flag to _fdopen() on Windows, the file will be opened in a "translate mode", where it will take care of converting \n to \r\n, and also look for the CTRL-Z mark when opening the log file in append mode. Reference: <http://msdn.microsoft.com/en-us/library/dye30d82%28VS.80%29.aspx> Thanks to Alon Bar-Lev for pointing out this solution. Reported-by: Thomas Reifferscheid Signed-off-by: David Sommerseth <davids@redhat.com> Acked-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
ef2cbc771a
commit
527a351d58
2
error.c
2
error.c
@ -506,7 +506,7 @@ redirect_stdout_stderr (const char *file, bool append)
|
|||||||
|
|
||||||
/* open log_handle as FILE stream */
|
/* open log_handle as FILE stream */
|
||||||
ASSERT (msgfp == NULL);
|
ASSERT (msgfp == NULL);
|
||||||
msgfp = _fdopen (log_fd, "w");
|
msgfp = _fdopen (log_fd, "wt");
|
||||||
if (msgfp == NULL)
|
if (msgfp == NULL)
|
||||||
msg (M_ERR, "Error: --log redirect failed due to _fdopen");
|
msg (M_ERR, "Error: --log redirect failed due to _fdopen");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user