summaryrefslogtreecommitdiff
path: root/src/condition.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-12 04:25:02 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-12 04:25:02 +0200
commit82e487c56d0947796793b6fd2836264328defe9f (patch)
tree2dfd5d979d064c7bc116cfca28ea1e1df65eac70 /src/condition.c
parent3611581ebdabbe3a1d6a9b5310a0b59792279d7d (diff)
unit: introduce ConditionFileIsExecutable= and use it where we check for a binary we'll spawn
Diffstat (limited to 'src/condition.c')
-rw-r--r--src/condition.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/condition.c b/src/condition.c
index 76ee0370d2..f9202f6850 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -168,6 +168,15 @@ bool condition_test(Condition *c) {
return !(k == -ENOENT || k > 0) == !c->negate;
}
+ case CONDITION_FILE_IS_EXECUTABLE: {
+ struct stat st;
+
+ if (lstat(c->parameter, &st) < 0)
+ return !c->negate;
+
+ return (S_ISREG(st.st_mode) && (st.st_mode & 0111)) == !c->negate;
+ }
+
case CONDITION_KERNEL_COMMAND_LINE:
return test_kernel_command_line(c->parameter) == !c->negate;