diff options
author | Franck Bui <fbui@suse.com> | 2017-06-27 09:52:12 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2017-06-27 10:04:20 +0200 |
commit | b9088048b15cd21242b2308498fa865f864bfe45 (patch) | |
tree | 87ecb02b4142b1297e6f94c5d92723058e202855 /src/shared/fstab-util.c | |
parent | d31ae54818c7a02d4bb07aa41e24166d252d6f31 (diff) | |
download | systemd-b9088048b15cd21242b2308498fa865f864bfe45.tar.gz |
fstab-util: don't eat up errors in fstab_is_mount_point()
That way the caller can decide what to do with failures, whether to consider
them or ignore them.
Diffstat (limited to 'src/shared/fstab-util.c')
-rw-r--r-- | src/shared/fstab-util.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index c3106f1ae9..5675b0beac 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -34,18 +34,23 @@ #include "strv.h" #include "util.h" -bool fstab_is_mount_point(const char *mount) { +int fstab_is_mount_point(const char *mount) { _cleanup_endmntent_ FILE *f = NULL; struct mntent *m; f = setmntent("/etc/fstab", "re"); if (!f) - return false; + return errno == ENOENT ? false : -errno; + + for (;;) { + errno = 0; + m = getmntent(f); + if (!m) + return errno != 0 ? -errno : false; - while ((m = getmntent(f))) if (path_equal(m->mnt_dir, mount)) return true; - + } return false; } |