Commit b9f91437 authored by LRN's avatar LRN

Fudge glib fileutils test to pass on Windows

1) Creating a directory with 0666 does not prevent
traversal on Windows (ACL determines the possibility
of traversal, and Windows mkdir() does not translate
permission bits into ACL). Don't do the traversal check on Windows.

2) Creating a file with 0555 also isn't translated into
read-only ACL, Windows sets the read-only attribute instead,
which blocks all changes, including changes to file times.
Add the write permissions on Windows before changing file times.
parent d3d6ef60
......@@ -913,9 +913,12 @@ test_stdio_wrappers (void)
cwd = g_get_current_dir ();
path = g_build_filename (cwd, "mkdir-test", NULL);
g_free (cwd);
#ifndef G_OS_WIN32
/* 0666 on directories means nothing to Windows, it only obeys ACLs */
ret = g_chdir (path);
g_assert_cmpint (errno, ==, EACCES);
g_assert_cmpint (ret, ==, -1);
#endif
ret = g_chmod (path, 0777);
g_assert_cmpint (ret, ==, 0);
ret = g_chdir (path);
......@@ -945,6 +948,15 @@ test_stdio_wrappers (void)
g_close (ret, &error);
g_assert_no_error (error);
#ifdef G_OS_WIN32
/* On Windows the 5 permission bit results in a read-only file
* that cannot be modified in any way (attribute changes included).
* Remove the read-only attribute via chmod().
*/
ret = g_chmod ("test-create", 0666);
g_assert_cmpint (ret, ==, 0);
#endif
ut.actime = ut.modtime = (time_t)0;
ret = g_utime ("test-create", &ut);
g_assert_cmpint (ret, ==, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment