diff --git a/src/shared/condition.c b/src/shared/condition.c index 6e769e9d59..dae75a5bf5 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -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) {