libmount: don't return root if path contains // or ending /

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>
This commit is contained in:
Søren Holm 2014-09-26 18:35:11 +02:00 committed by Karel Zak
parent 42f00a7df5
commit 41510d26dd
1 changed files with 1 additions and 1 deletions

View 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');