]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mountpoint-util: introduce mount_propagation_flag_is_valid()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Dec 2022 17:48:59 +0000 (02:48 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Dec 2022 05:15:59 +0000 (14:15 +0900)
src/basic/mountpoint-util.c
src/basic/mountpoint-util.h
src/core/dbus-execute.c

index 0c9fc0a35059850a6b0d70ed55446c6a08d4296b..1136454b7df79a7f0f571f85932a6db6d724eaf6 100644 (file)
@@ -598,3 +598,7 @@ int mount_propagation_flag_from_string(const char *name, unsigned long *ret) {
                 return -EINVAL;
         return 0;
 }
+
+bool mount_propagation_flag_is_valid(unsigned long flag) {
+        return IN_SET(flag, 0, MS_SHARED, MS_PRIVATE, MS_SLAVE);
+}
index c7b24584da268219145ea8144e26ebd51980e5d5..19709195e84e346b23f903a839fd5d27a452002c 100644 (file)
@@ -57,3 +57,4 @@ int mount_nofollow(const char *source, const char *target, const char *filesyste
 
 const char *mount_propagation_flag_to_string(unsigned long flags);
 int mount_propagation_flag_from_string(const char *name, unsigned long *ret);
+bool mount_propagation_flag_is_valid(unsigned long flag);
index 4b41cfe778c4056c299537e3d37cf6ae88f73aab..41eeb1ee941a01c1ad83ab4ec877e49fe4f68189 100644 (file)
@@ -1600,7 +1600,7 @@ static int parse_personality(const char *s, unsigned long *p) {
 }
 
 static const char* mount_propagation_flag_to_string_with_check(unsigned long n) {
-        if (!IN_SET(n, 0, MS_SHARED, MS_PRIVATE, MS_SLAVE))
+        if (!mount_propagation_flag_is_valid(n))
                 return NULL;
 
         return mount_propagation_flag_to_string(n);