chiark / gitweb /
condition: fix reversed tests if path does not exist at all
[elogind.git] / src / condition.c
index f84c81bd811cd48d2b8abbbf5424bd697a6f7db2..1438ea85a0c52ed25e82969e16fbd3470e7a1aa0 100644 (file)
@@ -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;
         }