summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2011-09-23 02:10:00 +0200
committerMichal Schmidt <mschmidt@redhat.com>2011-09-23 02:10:00 +0200
commit1f8fef5a44e6ce711808665bca6eb43d604fe279 (patch)
tree94e367511fa273102afc4a37aee19d40ac6b5923
parentf8440af5febb18ddfd2bc7a94b771284f0b7b310 (diff)
condition: fix reversed tests if path does not exist at all
CONDITION_PATH_IS_DIRECTORY, CONDITION_PATH_IS_SYMBOLIC_LINK and CONDITION_FILE_IS_EXECUTABLE gave reversed results when the path did not exist at all.
-rw-r--r--src/condition.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/condition.c b/src/condition.c
index f84c81bd81..1438ea85a0 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -163,7 +163,7 @@ bool condition_test(Condition *c) {
struct stat st;
if (stat(c->parameter, &st) < 0)
- return !c->negate;
+ return c->negate;
return S_ISDIR(st.st_mode) == !c->negate;
}
@@ -171,7 +171,7 @@ bool condition_test(Condition *c) {
struct stat st;
if (lstat(c->parameter, &st) < 0)
- return !c->negate;
+ return c->negate;
return S_ISLNK(st.st_mode) == !c->negate;
}
@@ -189,7 +189,7 @@ bool condition_test(Condition *c) {
struct stat st;
if (stat(c->parameter, &st) < 0)
- return !c->negate;
+ return c->negate;
return (S_ISREG(st.st_mode) && (st.st_mode & 0111)) == !c->negate;
}