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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Jan 2022 09:59:07 +0000 (10:59 +0100)
(cherry picked from commit 193105f2d0408e2d96265935174b3cf0f100ef2e)
(cherry picked from commit 10fc8b7775a8cfd9519a1c6628d813b1aa315a33)

src/shared/condition.c

index 766b87610d56534c01f1d0d6a98745cd33f1e986..9eab38b02719db40c7f6ceab7596ef2402b4d831 100644 (file)
@@ -800,7 +800,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) {