From d4e89dea4e8e95cee0cede39dc77618a181b8d19 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 8 Aug 2016 17:23:54 +0200 Subject: 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 Signed-off-by: Karel Zak --- libmount/src/fs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libmount/src/fs.c') 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); } /** -- cgit v1.2.3-55-g7522