]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: don't return root if path contains // or ending /
authorSøren Holm <sgh@sgh.dk>
Fri, 26 Sep 2014 16:35:11 +0000 (18:35 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Oct 2014 08:01:35 +0000 (10:01 +0200)
If the path fx. is /foo/bar/ the initial stripoff will replace the last slash
with \0 and return a pointer to that exact \0 character. The same thing will
happen if the path contains // somewhere.

Signed-off-by: Søren Holm <sgh@sgh.dk>
libmount/src/tab.c

index 011ba5429106b2eb091b5ac43007078a020112a8..2b0a34371ded56639c2b2d4e5970a75345fa2c55 100644 (file)
@@ -864,7 +864,7 @@ struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,
                }
 
                p = stripoff_last_component(mnt);
-               if (!p || !*p)
+               if (!p)
                        break;
        } while (mnt && *(mnt + 1) != '\0');