[glib: 1/2] tests: Fix skipping mkdir-with-parents-permission test



commit 2118a8f73bdcfed1fc58c14ecc67744acf16d210
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Sep 2 12:21:11 2019 +0100

    tests: Fix skipping mkdir-with-parents-permission test
    
    If the user has `CAP_DAC_OVERRIDE` or similar (for example, if running
    the tests as root), the `mkdir-with-parents-permission` test is skipped.
    
    The check for `CAP_DAC_OVERRIDE` was by creating a subdirectory of the
    test directory. That subdirectory, however, was never removed, which
    caused a ‘directory not empty’ error when trying to delete the test
    directory.
    
    Fix that by correctly deleting the subdirectory if skipping the test.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/tests/fileutils.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index a86ba478d..07a91a67f 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -548,6 +548,7 @@ test_mkdir_with_parents_permission (void)
   if (g_mkdir (subdir2, 0700) == 0)
     {
       g_test_skip ("have CAP_DAC_OVERRIDE or equivalent, cannot test");
+      g_remove (subdir2);
     }
   else
     {


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