gnucash maint: Bug 764248 - saved-reports-2.4-backup line endings unconventional
John Ralls
jralls at code.gnucash.org
Wed Jun 22 19:26:12 EDT 2016
Updated via https://github.com/Gnucash/gnucash/commit/9c71a6cc (commit)
from https://github.com/Gnucash/gnucash/commit/2d68c815 (commit)
commit 9c71a6cc64647940e33b4d2d90f0ccb03de72a0e
Author: John Ralls <jralls at ceridwen.us>
Date: Wed Jun 22 16:25:55 2016 -0700
Bug 764248 - saved-reports-2.4-backup line endings unconventional
diff --git a/src/report/report-system/gnc-report.c b/src/report/report-system/gnc-report.c
index 13f34bd..95fc02d 100644
--- a/src/report/report-system/gnc-report.c
+++ b/src/report/report-system/gnc-report.c
@@ -230,7 +230,14 @@ gnc_saved_reports_write_internal (const gchar *file, const gchar *contents, gboo
ssize_t written;
gint length;
gint flags = O_WRONLY | O_CREAT | (overwrite ? O_TRUNC : O_APPEND);
-
+ /* Bug 764248: Keep write from adding \r to the line endings. On
+ * windows the file already has them set to \r\n and if we output
+ * in text mode we get \r\r\n.
+ */
+#ifdef G_OS_WIN32
+ if (strstr(file, "backup"))
+ flags |= O_BINARY;
+#endif
fd = g_open (file, flags, 0666);
if (fd == -1)
{
Summary of changes:
src/report/report-system/gnc-report.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list