From ec12871e60796e5ce63303c5be8c75f146edfef8 Mon Sep 17 00:00:00 2001 From: TingPing Date: Fri, 27 Feb 2015 15:59:06 -0500 Subject: Write scrollback as binary on win32 Proper fix for b66edd3 This issue likely applies elsewhere in HexChat --- src/common/text.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/common/text.c b/src/common/text.c index 2a8a50f7..ae18b8e6 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -176,7 +176,11 @@ scrollback_shrink (session *sess) p++; } +#ifdef WIN32 + fh = g_open (file, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY | _O_BINARY, 0644); +#else fh = g_open (file, O_CREAT | O_TRUNC | O_APPEND | O_WRONLY, 0644); +#endif g_free (file); if (fh == -1) { @@ -301,13 +305,6 @@ scrollback_load (session *sess) { char *buf_tmp; - /* If nothing but funny trailing matter e.g. 0x0d or 0x0d0a, toss it */ - if (n_bytes >= 1 && buf[0] == 0x0d) - { - g_free (buf); - continue; - } - n_bytes--; buf_tmp = buf; buf = g_strndup (buf_tmp, n_bytes); @@ -599,7 +596,7 @@ log_open_file (char *servname, char *channame, char *netname) return -1; #ifdef WIN32 - fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY, S_IREAD|S_IWRITE); + fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY | _O_BINARY, S_IREAD|S_IWRITE); #else fd = g_open (file, O_CREAT | O_APPEND | O_WRONLY, 0644); #endif -- cgit 1.4.1