Patchwork [2/2] trace: use binary file open mode in simpletrace

login
register
mail settings
Submitter Stefan Hajnoczi
Date Sept. 9, 2011, 9:37 a.m.
Message ID <1315561022-25386-3-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/114035/
State New
Headers show

Comments

Stefan Hajnoczi - Sept. 9, 2011, 9:37 a.m.
For Windows portability the simple trace backend must use the 'b' file
open mode.  This prevents the stdio library from mangling 0x0a/0x0d
newline characters.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 trace/simple.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/trace/simple.c b/trace/simple.c
index 92c315a..2f7dfbc 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -230,7 +230,7 @@  void st_set_trace_file_enabled(bool enable)
             .x1 = HEADER_VERSION,
         };
 
-        trace_fp = fopen(trace_file_name, "w");
+        trace_fp = fopen(trace_file_name, "wb");
         if (!trace_fp) {
             return;
         }