mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 22:58:50 +01:00
Restitute a successful stat call to this test case.
Since the first stat call is made for it to deliberately fail, and we reference st.st_mode without st having valid data, st.st_mode can contain garbage and cause chmod to fail with EINVAL. We rerun stat and ensure it succeeded. Also make use of tt_abort_perror, to properly convey failure reasons to the user.
This commit is contained in:
parent
8999150f71
commit
f49805b681
1 changed files with 6 additions and 1 deletions
|
@ -221,12 +221,17 @@ test_config_check_or_create_data_subdir(void *arg)
|
||||||
// and is private to the user.
|
// and is private to the user.
|
||||||
test_assert(!check_or_create_data_subdir(subdir));
|
test_assert(!check_or_create_data_subdir(subdir));
|
||||||
|
|
||||||
|
r = stat(subpath, &st);
|
||||||
|
if (r) {
|
||||||
|
tt_abort_perror("stat");
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined (_WIN32) || defined (WINCE)
|
#if !defined (_WIN32) || defined (WINCE)
|
||||||
group_permission = st.st_mode | 0070;
|
group_permission = st.st_mode | 0070;
|
||||||
r = chmod(subpath, group_permission);
|
r = chmod(subpath, group_permission);
|
||||||
|
|
||||||
if (r) {
|
if (r) {
|
||||||
test_fail_msg("Changing permissions for the subdirectory failed.");
|
tt_abort_perror("chmod");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the directory exists, but its mode is too permissive
|
// If the directory exists, but its mode is too permissive
|
||||||
|
|
Loading…
Add table
Reference in a new issue