]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fix ConditionDirectoryNotEmpty when it comes to a Non-directory file
authorjiangchuangang <jiangchuangang@huawei.com>
Mon, 29 Nov 2021 14:30:37 +0000 (22:30 +0800)
committerjiangchuangang <jiangchuangang@huawei.com>
Tue, 30 Nov 2021 01:16:15 +0000 (09:16 +0800)
src/shared/condition.c

index 6e769e9d59b0ce21ff2e5e78f796c548b1d3e929..a86f2b9ffbec2210a2dd7fa5bcecb41888ef318a 100644 (file)
@@ -931,7 +931,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) {