summaryrefslogtreecommitdiff
path: root/src/condition.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-11-15 20:06:49 +0100
committerLennart Poettering <lennart@poettering.net>2010-11-15 22:13:25 +0100
commit36af55d99711e9accdf42d8a7df60e069f4086c0 (patch)
tree789d2d3d0c8e677be15f142b0c72ffab72e73f3b /src/condition.c
parent5c273f855630bf54f6ebe95ea8b45c8abe2ffff6 (diff)
unit: introduce ConditionDirectoryNotEmpty=
Diffstat (limited to 'src/condition.c')
-rw-r--r--src/condition.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/condition.c b/src/condition.c
index 4bbd4dbafa..21da2eb9e9 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -106,6 +106,13 @@ bool condition_test(Condition *c) {
case CONDITION_PATH_EXISTS:
return (access(c->parameter, F_OK) >= 0) == !c->negate;
+ case CONDITION_DIRECTORY_NOT_EMPTY: {
+ int k;
+
+ k = dir_is_empty(c->parameter);
+ return !(k == -ENOENT || k > 0) == !c->negate;
+ }
+
case CONDITION_KERNEL_COMMAND_LINE:
return !!test_kernel_command_line(c->parameter) == !c->negate;