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.
This commit is contained in:
Chun-wei Fan 2015-07-20 11:53:51 +08:00
parent 5393f34b8e
commit 7a72d3bbae

View File

@ -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);