]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: optimize for paths with tailing slash
authorKarel Zak <kzak@redhat.com>
Fri, 24 Feb 2012 20:30:22 +0000 (21:30 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 24 Feb 2012 20:30:22 +0000 (21:30 +0100)
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>
libmount/src/tab.c

index f10c1de47507c785bd7806abd35db009d8d17e77..66a9e4dcdbee92471ee64c8e7a1a1acc9b095bac 100644 (file)
@@ -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)))