[glib/fix-fileutils-test-windows] glib/tests/fileutils.c: Fix stdio Wrapper Test on Windows



commit 7a72d3bbae6994efcb889bb58ab3fc63916a2515
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jul 20 11:53:51 2015 +0800

    glib/tests/fileutils.c: Fix stdio Wrapper Test on Windows
    
    The g_creat() call was done in *nix style in regards to the mode parameter,
    which the Windows CRT isn't going to understand (nor like, on newer CRTs).
    
    Update the program such that it will pass, by using Windows-style
    permission mode parameters for g_creat(), on Windows.

 glib/tests/fileutils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index b1f0cbc74..61ea230bb 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -37,6 +37,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <utime.h>
+
+#define G_TEST_DIR_MODE 0555
 #endif
 #include <fcntl.h>
 #ifdef G_OS_WIN32
@@ -49,6 +51,8 @@
 #ifndef F_OK
 #define F_OK 0
 #endif
+
+#define G_TEST_DIR_MODE (S_IWRITE | S_IREAD)
 #endif
 
 #define S G_DIR_SEPARATOR_S
@@ -936,7 +940,7 @@ test_stdio_wrappers (void)
   g_free (cwd);
   g_free (path);
 
-  ret = g_creat ("test-creat", 0555);
+  ret = g_creat ("test-creat", G_TEST_DIR_MODE);
   g_close (ret, &error);
   g_assert_no_error (error);
 


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