diff options
Diffstat (limited to 'glib/tests/fileutils.c')
-rw-r--r-- | glib/tests/fileutils.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 0d6012a5f..ab5b574cc 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -812,6 +812,9 @@ static void test_mkdir_with_parents (void) { gchar *cwd, *new_path; +#ifndef G_OS_WIN32 + gboolean can_override_dac = check_cap_dac_override (NULL); +#endif if (g_test_verbose()) g_printerr ("checking g_mkdir_with_parents() in subdir ./hum/"); test_mkdir_with_parents_1 ("hum"); @@ -838,10 +841,20 @@ test_mkdir_with_parents (void) g_remove ("./test"); #ifndef G_OS_WIN32 - g_assert_cmpint (g_mkdir_with_parents ("/usr/b/c", 0), ==, -1); - /* EPERM or EROFS may be returned if the filesystem as a whole is read-only */ - if (errno != EPERM && errno != EROFS) - g_assert_cmpint (errno, ==, EACCES); + if (can_override_dac) + { + g_assert_cmpint (g_mkdir_with_parents ("/usr/b/c", 0), ==, 0); + g_remove ("/usr/b/c"); + g_remove ("/usr/b"); + } + else + { + g_assert_cmpint (g_mkdir_with_parents ("/usr/b/c", 0), ==, -1); + /* EPERM or EROFS may be returned if the filesystem as a whole is read-only */ + if (errno != EPERM && errno != EROFS) + g_assert_cmpint (errno, ==, EACCES); + } + #endif g_assert_cmpint (g_mkdir_with_parents (NULL, 0), ==, -1); |