chiark / gitweb /
mount-setup: change system mount propagation to shared by default
[elogind.git] / src / core / condition.c
index 3b246f1a64ed479fee757439abf60940617ebd25..e4080d569d7601bdaf1c75edd6bc69fa4e20866b 100644 (file)
@@ -33,6 +33,7 @@
 #include "util.h"
 #include "condition.h"
 #include "virt.h"
+#include "path-util.h"
 
 Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
         Condition *c;
@@ -223,14 +224,8 @@ bool condition_test(Condition *c) {
         case CONDITION_PATH_IS_MOUNT_POINT:
                 return (path_is_mount_point(c->parameter, true) > 0) == !c->negate;
 
-        case CONDITION_PATH_IS_READ_WRITE: {
-                struct statvfs st;
-
-                if (statvfs(c->parameter, &st) < 0)
-                        return c->negate;
-
-                return !(st.f_flag & ST_RDONLY) == !c->negate;
-        }
+        case CONDITION_PATH_IS_READ_WRITE:
+                return (path_is_read_only_fs(c->parameter) > 0) == c->negate;
 
         case CONDITION_DIRECTORY_NOT_EMPTY: {
                 int k;