1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

Merge pull request #21559 from jcg190701/main

fix ConditionDirectoryNotEmpty when it comes to a Non-directory file
This commit is contained in:
Yu Watanabe 2021-11-30 22:34:21 +09:00 committed by GitHub
commit b224530f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -894,11 +894,15 @@ static int condition_test_path_is_mount_point(Condition *c, char **env) {
}
static int condition_test_path_is_read_write(Condition *c, char **env) {
int r;
assert(c);
assert(c->parameter);
assert(c->type == CONDITION_PATH_IS_READ_WRITE);
return path_is_read_only_fs(c->parameter) <= 0;
r = path_is_read_only_fs(c->parameter);
return r <= 0 && r != -ENOENT;
}
static int condition_test_cpufeature(Condition *c, char **env) {
@ -931,7 +935,7 @@ static int condition_test_directory_not_empty(Condition *c, char **env) {
assert(c->type == CONDITION_DIRECTORY_NOT_EMPTY);
r = dir_is_empty(c->parameter);
return r <= 0 && r != -ENOENT;
return r <= 0 && !IN_SET(r, -ENOENT, -ENOTDIR);
}
static int condition_test_file_not_empty(Condition *c, char **env) {