test: fix fd_is_mount_point() check
authorLennart Poettering <lennart@poettering.net>
Thu, 17 Dec 2020 15:19:09 +0000 (16:19 +0100)
committerMichael Biebl <biebl@debian.org>
Sat, 2 Jan 2021 16:06:01 +0000 (16:06 +0000)
commitb4e5133d559e2dfda11781a023b033efe00bb166
tree6481596e60ce00efee720a7048604a771f7272d5
parentb4426c37957d2e2dbb9bb880100fcc214e8b4b4b
test: fix fd_is_mount_point() check

So the currentl and only fd_is_mount_point() check is actually entirely
bogus: it passes "/" as filename argument, but that's not actually a
a valid filename, but an absolute path.

fd_is_mount_point() is written in a way tha the fd refers to a directory
and the specified path is a file directly below it that shall be
checked. The test call actually violated that rule, but still expected
success.

Let's fix this, and check for this explicitly, and refuse it.

Let's extend the test and move it to test-mountpoint-util.c where the
rest of the tests for related calls are placed.

Replaces: #18004
Fixes: #17950
(cherry picked from commit 95231c7215c3ff14c491eb1d2a93312a8fe0c4f6)

Gbp-Pq: Name test-fix-fd_is_mount_point-check.patch
src/basic/mountpoint-util.c
src/test/test-mountpoint-util.c
src/test/test-path-util.c