mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 16:36:14 +01:00
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.
This commit is contained in:
parent
d3d6ef60c6
commit
b9f91437bb
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user