From 527a351d5843793d016735a5e24daab42442ba45 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Mon, 13 Dec 2010 12:49:00 +0100 Subject: 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: Thanks to Alon Bar-Lev for pointing out this solution. Reported-by: Thomas Reifferscheid Signed-off-by: David Sommerseth Acked-by: Gert Doering --- error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/error.c b/error.c index 5c53251..9754464 100644 --- a/error.c +++ b/error.c @@ -506,7 +506,7 @@ redirect_stdout_stderr (const char *file, bool append) /* open log_handle as FILE stream */ ASSERT (msgfp == NULL); - msgfp = _fdopen (log_fd, "w"); + msgfp = _fdopen (log_fd, "wt"); if (msgfp == NULL) msg (M_ERR, "Error: --log redirect failed due to _fdopen"); -- cgit v1.2.3