summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab.c
diff options
context:
space:
mode:
authorKarel Zak2012-02-24 21:30:22 +0100
committerKarel Zak2012-02-24 21:30:22 +0100
commitea371ea30e873f553bd4666f1e8f7b0620dc5345 (patch)
tree347621498153a66f24d5a2e7720edbe0a2da1604 /libmount/src/tab.c
parentlib/canonicalize: always remove tailing slash (diff)
downloadkernel-qcow2-util-linux-ea371ea30e873f553bd4666f1e8f7b0620dc5345.tar.gz
kernel-qcow2-util-linux-ea371ea30e873f553bd4666f1e8f7b0620dc5345.tar.xz
kernel-qcow2-util-linux-ea371ea30e873f553bd4666f1e8f7b0620dc5345.zip
libmount: optimize for paths with tailing slash
mnt_table_find_target() canonicalizes paths by libmnt cache, but it's overkill if the difference between paths is tailing slash only. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab.c')
-rw-r--r--libmount/src/tab.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index f10c1de47..66a9e4dcd 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -438,7 +438,7 @@ struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb, const char *pat
/* native @target */
mnt_reset_iter(&itr, direction);
while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
- if (fs->target && strcmp(fs->target, path) == 0)
+ if (fs->target && streq_except_trailing_slash(fs->target, path))
return fs;
}
if (!tb->cache || !(cn = mnt_resolve_path(path, tb->cache)))