test: fix fd_is_mount_point() check v247.3
authorLennart Poettering <lennart@poettering.net>
Thu, 17 Dec 2020 15:19:09 +0000 (16:19 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Feb 2021 15:29:47 +0000 (16:29 +0100)
commit551dd873b0bdfb9e7e47431b2933c8b910228f0c
treeda68ca54bb79f4080079bf0828acda937593a4e1
parent1cb171695a3e74f3fb1a16a553fbea3a33336d11
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)
src/basic/mountpoint-util.c
src/test/test-mountpoint-util.c
src/test/test-path-util.c