summaryrefslogtreecommitdiff
path: root/src/shared/path-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-05 11:26:58 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-06 10:57:53 +0200
commite792e890fe8343b922542f52af09e058f8fa85ab (patch)
tree5bde036fa5f754b6ab375dcc0937fd737a3e7dd9 /src/shared/path-util.c
parent05d990efd7dda29835cfe9e4c03d5864b055b58b (diff)
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.
Diffstat (limited to 'src/shared/path-util.c')
-rw-r--r--src/shared/path-util.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 8487d26fca..a01475a614 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -496,8 +496,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;
}
@@ -537,12 +535,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)
@@ -559,18 +553,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);
}