aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-03-26 21:27:28 -0500
committerEric Sandeen <sandeen@redhat.com>2018-03-26 21:27:28 -0500
commitbe66eb8ef581ae50ec9fe6ff8a95a58fe62c2b45 (patch)
tree6a83047d1ff039cb2b85cac5e7eee6209e49cb24
parentf8cd7da8eec39dddbdeebac8617b64f2a1a2deb0 (diff)
downloadxfsprogs-dev-be66eb8ef581ae50ec9fe6ff8a95a58fe62c2b45.tar.gz
libfrog: fs_table_lookup_mount should realpath the argument
Call realpath on the dir argument so that we're comparing canonical paths when looking for the mountpoint. This fixes the problem where '/home/' doesn't match '/home' even though they refer to the same thing. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--libfrog/paths.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libfrog/paths.c b/libfrog/paths.c
index 62b4eda6a0..19ee1ea9e4 100644
--- a/libfrog/paths.c
+++ b/libfrog/paths.c
@@ -102,16 +102,19 @@ fs_table_lookup_mount(
uint i;
dev_t dev = 0;
char rpath[PATH_MAX];
+ char dpath[PATH_MAX];
if (fs_device_number(dir, &dev))
return NULL;
+ if (!realpath(dir, dpath))
+ return NULL;
for (i = 0; i < fs_count; i++) {
if (fs_table[i].fs_flags != FS_MOUNT_POINT)
continue;
if (!realpath(fs_table[i].fs_dir, rpath))
continue;
- if (strcmp(rpath, dir) == 0)
+ if (strcmp(rpath, dpath) == 0)
return &fs_table[i];
}
return NULL;