Merge branch 'tor-gitlab/mr/129'

This commit is contained in:
David Goulet 2020-09-17 09:17:53 -04:00
commit a47d12c64d

View File

@ -4476,11 +4476,11 @@ test_util_glob(void *ptr)
tor_asprintf(&forbidden_forbidden, tor_asprintf(&forbidden_forbidden,
"%s"PATH_SEPARATOR"forbidden"PATH_SEPARATOR"forbidden",dirname); "%s"PATH_SEPARATOR"forbidden"PATH_SEPARATOR"forbidden",dirname);
#ifndef _WIN32 #ifndef _WIN32
chmod(forbidden, 0700); tt_int_op(0, OP_EQ, chmod(forbidden, 0700));
#endif #endif
tt_int_op(0, OP_EQ, create_test_directory_structure(forbidden)); tt_int_op(0, OP_EQ, create_test_directory_structure(forbidden));
#ifndef _WIN32 #ifndef _WIN32
chmod(forbidden, 0); tt_int_op(0, OP_EQ, chmod(forbidden, 0));
#endif #endif
#define TEST(input) \ #define TEST(input) \
@ -4639,10 +4639,10 @@ test_util_glob(void *ptr)
done: done:
#ifndef _WIN32 #ifndef _WIN32
chmod(forbidden, 0700); (void) chmod(forbidden, 0700);
chmod(dir1_forbidden, 0700); (void) chmod(dir1_forbidden, 0700);
chmod(dir2_forbidden, 0700); (void) chmod(dir2_forbidden, 0700);
chmod(forbidden_forbidden, 0700); (void) chmod(forbidden_forbidden, 0700);
#endif #endif
tor_free(dir1); tor_free(dir1);
tor_free(dir2); tor_free(dir2);
@ -4832,10 +4832,20 @@ test_util_get_glob_opened_files(void *ptr)
done: done:
#ifndef _WIN32 #ifndef _WIN32
chmod(forbidden, 0700); {
chmod(dir1_forbidden, 0700); int chmod_failed = 0;
chmod(dir2_forbidden, 0700); if (forbidden)
chmod(forbidden_forbidden, 0700); chmod_failed |= chmod(forbidden, 0700);
if (dir1_forbidden)
chmod_failed |= chmod(dir1_forbidden, 0700);
if (dir2_forbidden)
chmod_failed |= chmod(dir2_forbidden, 0700);
if (forbidden_forbidden)
chmod_failed |= chmod(forbidden_forbidden, 0700);
if (chmod_failed) {
TT_FAIL(("unable to chmod a file on cleanup: %s", strerror(errno)));
}
}
#endif #endif
tor_free(dir1); tor_free(dir1);
tor_free(dir2); tor_free(dir2);