[gimp/gimp-2-10] tools: fix windows file handling in gimp-test-clipboard.c



commit 727b83cbe651f2b9f3b13d7b366944675b25e50e
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 11 19:30:48 2019 +0200

    tools: fix windows file handling in gimp-test-clipboard.c
    
    Use g_open() for proper filename encoding and _O_BINARY to avoid line
    ending conversions.
    
    (cherry picked from commit a9b36245c9e976557e9d6ff29d74aac325a89273)

 tools/gimp-test-clipboard.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/tools/gimp-test-clipboard.c b/tools/gimp-test-clipboard.c
index d4bd665399..04f02e3413 100644
--- a/tools/gimp-test-clipboard.c
+++ b/tools/gimp-test-clipboard.c
@@ -18,6 +18,11 @@
 #include <unistd.h>
 #endif
 
+#include <glib/gstdio.h>
+#ifndef _O_BINARY
+#define _O_BINARY 0
+#endif
+
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
@@ -373,7 +378,7 @@ test_clipboard_paste (GtkClipboard *clipboard,
       if (! strcmp (filename, "-"))
         fd = 1;
       else
-        fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+        fd = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | _O_BINARY, 0666);
 
       if (fd < 0)
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]