summary refs log tree commit diff stats
path: root/src/common/text.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2015-02-27 15:59:06 -0500
committerTingPing <tingping@tingping.se>2015-02-27 16:20:09 -0500
commitec12871e60796e5ce63303c5be8c75f146edfef8 (patch)
tree5ecfc10715e58b116387bb939368cbb70feeb567 /src/common/text.c
parent0a29313ffffa5c0f65826744d48b58c487795e21 (diff)
Write scrollback as binary on win32
Proper fix for b66edd3
This issue likely applies elsewhere in HexChat
Diffstat (limited to 'src/common/text.c')
-rw-r--r--src/common/text.c13
1 files 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