summaryrefslogtreecommitdiffstats
path: root/libmount/src/fs.c
diff options
context:
space:
mode:
authorKarel Zak2014-07-01 10:34:09 +0200
committerKarel Zak2014-07-01 10:34:09 +0200
commit8642cd7b0f06157c1e4e8aae616bee78fa6a250f (patch)
treeccbd95a26e288f5fd4d6ddcedb337a27847b79ac /libmount/src/fs.c
parentfindmnt: use mnt_cache_set_targets() for non-kernel table (diff)
downloadkernel-qcow2-util-linux-8642cd7b0f06157c1e4e8aae616bee78fa6a250f.tar.gz
kernel-qcow2-util-linux-8642cd7b0f06157c1e4e8aae616bee78fa6a250f.tar.xz
kernel-qcow2-util-linux-8642cd7b0f06157c1e4e8aae616bee78fa6a250f.zip
libmount: always use mnt_resolve_target() in mnt_fs_match_target()
The requested path is also target mountpoint, so let's optimize realpath() usage as well. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/fs.c')
-rw-r--r--libmount/src/fs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index 82541083a..fe3260bb3 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -1411,11 +1411,15 @@ int mnt_fs_append_comment(struct libmnt_fs *fs, const char *comm)
*
* Possible are three attempts:
* 1) compare @target with @fs->target
+ *
* 2) realpath(@target) with @fs->target
+ *
* 3) realpath(@target) with realpath(@fs->target) if @fs is not from
- * /proc/self/mountinfo. However, if mnt_cache_set_targets(cache,
- * mtab) was called, and the path @fs->target is found in @mtab,
- * this comparison is not performed (see mnt_resolve_target()).
+ * /proc/self/mountinfo.
+ *
+ * However, if mnt_cache_set_targets(cache, mtab) was called, and the
+ * path @target or @fs->target is found in the @mtab, the canonicalization is
+ * is not performed (see mnt_resolve_target()).
*
* The 2nd and 3rd attempts are not performed when @cache is NULL.
*
@@ -1435,7 +1439,7 @@ int mnt_fs_match_target(struct libmnt_fs *fs, const char *target,
if (!rc && cache) {
/* 2) - canonicalized and non-canonicalized */
- char *cn = mnt_resolve_path(target, cache);
+ char *cn = mnt_resolve_target(target, cache);
rc = (cn && mnt_fs_streq_target(fs, cn));
/* 3) - canonicalized and canonicalized */