summaryrefslogtreecommitdiff
path: root/src/test/test-path-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-23 13:23:03 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-23 13:40:54 +0200
commit3f72b427b44f39a1aec6806dad6f6b57103ae9ed (patch)
tree010e80281bcff5910756cc00b1bdc115b569070d /src/test/test-path-util.c
parent47d36b7c851f9145def609e4f9d8feb6d3d33740 (diff)
path-util: make use of "mnt_id" field exported in /proc/self/fdinfo/<fd> to test for mount points
It's a very recent kernel addition, but certainly makes sense to support.
Diffstat (limited to 'src/test/test-path-util.c')
-rw-r--r--src/test/test-path-util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index 55d75ae7a1..e5b9c28bc0 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -36,6 +36,8 @@
}
static void test_path(void) {
+ _cleanup_close_ int fd = -1;
+
test_path_compare("/goo", "/goo", 0);
test_path_compare("/goo", "/goo", 0);
test_path_compare("//goo", "/goo", 0);
@@ -89,9 +91,16 @@ static void test_path(void) {
assert_se(path_is_mount_point("/", true) > 0);
assert_se(path_is_mount_point("/", false) > 0);
+ fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY);
+ assert_se(fd >= 0);
+ assert_se(fd_is_mount_point(fd) > 0);
+
assert_se(path_is_mount_point("/proc", true) > 0);
assert_se(path_is_mount_point("/proc", false) > 0);
+ assert_se(path_is_mount_point("/proc/1", true) == 0);
+ assert_se(path_is_mount_point("/proc/1", false) == 0);
+
assert_se(path_is_mount_point("/sys", true) > 0);
assert_se(path_is_mount_point("/sys", false) > 0);