diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-30 22:35:58 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-30 22:35:58 +0200 |
commit | 8abf5291564e771bfc62c74a55ab3f3b56f45257 (patch) | |
tree | ecf94296f296838f99e1b50c7636e3f52caf02c8 /src/shared | |
parent | 32c6d387bf8bef65edab442d521c2f93bbf2cd2d (diff) | |
parent | 0b6b6787e3f0ae8906ce0212bd629edbe931b73d (diff) |
Merge pull request #1425 from kaysievers/wip
gpt-auto-generator: check fstab for /boot entries
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/fstab-util.c | 17 | ||||
-rw-r--r-- | src/shared/fstab-util.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index e231a0ff80..db2146f8c1 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -20,9 +20,26 @@ ***/ #include "fstab-util.h" +#include "path-util.h" #include "strv.h" #include "util.h" +bool fstab_is_mount_point(const char *mount) { + _cleanup_free_ char *device = NULL; + _cleanup_endmntent_ FILE *f = NULL; + struct mntent *m; + + f = setmntent("/etc/fstab", "r"); + if (!f) + return false; + + while ((m = getmntent(f))) + if (path_equal(m->mnt_dir, mount)) + return true; + + return false; +} + int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered) { const char *name, *n = NULL, *x; diff --git a/src/shared/fstab-util.h b/src/shared/fstab-util.h index 387c562a96..872b2363cd 100644 --- a/src/shared/fstab-util.h +++ b/src/shared/fstab-util.h @@ -25,6 +25,7 @@ #include <stddef.h> #include "macro.h" +bool fstab_is_mount_point(const char *mount); int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered); |