summaryrefslogtreecommitdiffstats
path: root/libmount/src/fs.c
diff options
context:
space:
mode:
authorKarel Zak2016-08-08 17:23:54 +0200
committerKarel Zak2016-08-08 17:23:54 +0200
commitd4e89dea4e8e95cee0cede39dc77618a181b8d19 (patch)
tree00c24b4795795930d6bc618ebb1e9d9b68819992 /libmount/src/fs.c
parentuuidd: remove unnecessary pidpile path variable (diff)
downloadkernel-qcow2-util-linux-d4e89dea4e8e95cee0cede39dc77618a181b8d19.tar.gz
kernel-qcow2-util-linux-d4e89dea4e8e95cee0cede39dc77618a181b8d19.tar.xz
kernel-qcow2-util-linux-d4e89dea4e8e95cee0cede39dc77618a181b8d19.zip
libmount: ignore redundant slashes
///aaa/bbb and /aaa/bbb/ are the same paths. This is important especially with NFS where number of slashes are not the same in the /proc/self/mountinfo and fstab or utab. The regular URI is euler://tmp but /proc contains euler:/tmp Reported-by: Ales Novak <alnovak@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/fs.c')
-rw-r--r--libmount/src/fs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index c92b6abca..f8f63d4cf 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -422,8 +422,9 @@ int mnt_fs_set_source(struct libmnt_fs *fs, const char *source)
* @fs: fs
* @path: source path
*
- * Compares @fs source path with @path. The trailing slash is ignored.
- * See also mnt_fs_match_source().
+ * Compares @fs source path with @path. The redundant slashs are ignored.
+ * This function compares strings and does not cannonicalize the paths.
+ * See also more heavy and generic mnt_fs_match_source().
*
* Returns: 1 if @fs source path equal to @path, otherwise 0.
*/
@@ -437,7 +438,7 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path)
p = mnt_fs_get_srcpath(fs);
if (!mnt_fs_is_pseudofs(fs))
- return streq_except_trailing_slash(p, path);
+ return streq_paths(p, path);
if (!p && !path)
return 1;
@@ -450,14 +451,15 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path)
* @fs: fs
* @path: mount point
*
- * Compares @fs target path with @path. The trailing slash is ignored.
- * See also mnt_fs_match_target().
+ * Compares @fs target path with @path. The redundant slashs are ignored.
+ * This function compares strings and does not cannonicalize the paths.
+ * See also more generic mnt_fs_match_target().
*
* Returns: 1 if @fs target path equal to @path, otherwise 0.
*/
int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path)
{
- return fs && streq_except_trailing_slash(mnt_fs_get_target(fs), path);
+ return fs && streq_paths(mnt_fs_get_target(fs), path);
}
/**