diff options
author | Mike Yuan <me@yhndnzj.com> | 2023-07-13 17:13:10 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2023-07-13 19:27:02 +0200 |
commit | 35df78cd88e784abafd5df4545feeb3dd98e14a4 (patch) | |
tree | b5e51d7115347e8728054dd43731d97fec8142f6 /src/shared/fstab-util.c | |
parent | ukify: Derive public key from private key if not specified (diff) | |
download | systemd-35df78cd88e784abafd5df4545feeb3dd98e14a4.tar.xz systemd-35df78cd88e784abafd5df4545feeb3dd98e14a4.zip |
fstab-util: add fstab_is_bind
Diffstat (limited to 'src/shared/fstab-util.c')
-rw-r--r-- | src/shared/fstab-util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index b0e274afcc..6efdcd6896 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -20,6 +20,8 @@ int fstab_has_fstype(const char *fstype) { _cleanup_endmntent_ FILE *f = NULL; struct mntent *m; + assert(fstype); + f = setmntent(fstab_path(), "re"); if (!f) return errno == ENOENT ? false : -errno; @@ -288,3 +290,14 @@ char *fstab_node_to_udev_node(const char *p) { return strdup(p); } + +bool fstab_is_bind(const char *options, const char *fstype) { + + if (fstab_test_option(options, "bind\0" "rbind\0")) + return true; + + if (fstype && STR_IN_SET(fstype, "bind", "rbind")) + return true; + + return false; +} |