From: Harald Hoyer <[email protected]>
path_is_mount_point() compares the mount_id of a directory and the
mount_id of the parent directory. When following symlinks, the function
to get the parent directory does not take the symlink into account.
/bin -> /usr/bin with /usr being a mountpoint:
mount_id of /bin with AT_SYMLINK_FOLLOW != mount_id of /
---
src/shared/path-util.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index b9db7f1..acc7569 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -485,7 +485,17 @@ int path_is_mount_point(const char *t, bool allow_symlink)
{
return -errno;
}
- r = path_get_parent(t, &parent);
+ if (allow_symlink) {
+ char *real;
+ real = realpath(t, NULL);
+ if (!real)
+ return -errno;
+ r = path_get_parent(real, &parent);
+ free(real);
+ } else {
+ r = path_get_parent(t, &parent);
+ }
+
if (r < 0)
return r;
--
2.3.0
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel