From 88113c8b3f914766add73ff7a7976eced1534c14 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 5 Apr 2015 11:26:58 +0200 Subject: path-util: don't eat up ENOENT in path_is_mount_point() There's no reason to eat up ENOENT, it should be OK to simply report the error back. Signed-off-by: Anthony G. Basile --- src/shared/path-util.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/shared/path-util.c b/src/shared/path-util.c index 6855937a10..9374582ae2 100644 --- a/src/shared/path-util.c +++ b/src/shared/path-util.c @@ -356,8 +356,6 @@ int fd_is_mount_point(int fd) { * mount point), otherwise fallback to the * traditional stat() logic */ nosupp = true; - else if (errno == ENOENT) - return 0; else return -errno; } @@ -397,12 +395,8 @@ int fd_is_mount_point(int fd) { fallback: r = fstatat(fd, "", &a, AT_EMPTY_PATH); - if (r < 0) { - if (errno == ENOENT) - return 0; - + if (r < 0) return -errno; - } r = fstatat(fd, "..", &b, 0); if (r < 0) @@ -419,18 +413,15 @@ fallback: int path_is_mount_point(const char *t, bool allow_symlink) { _cleanup_close_ int fd = -1; + assert(t); if (path_equal(t, "/")) return 1; fd = openat(AT_FDCWD, t, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|(allow_symlink ? 0 : O_PATH)); - if (fd < 0) { - if (errno == ENOENT) - return 0; - + if (fd < 0) return -errno; - } return fd_is_mount_point(fd); } -- cgit v1.2.3-54-g00ecf