forked from len0rd/rockbox
[Bugfix] ft_assemble_path extra slashes, Volume unmound double free
Change-Id: Ie2e7702d8e252ce29af0b9dbd2e8d9e892b9ca18
This commit is contained in:
parent
19f21a2b3f
commit
52e22b253d
3 changed files with 56 additions and 30 deletions
|
@ -74,7 +74,7 @@ static void unmount_item(int item)
|
|||
if (!state)
|
||||
return;
|
||||
|
||||
if (state & NSITEM_CONTENTS)
|
||||
if (item == ROOT_CONTENTS_INDEX && state & NSITEM_CONTENTS)
|
||||
{
|
||||
fileobj_unmount(root_bindp);
|
||||
root_bindp = NULL;
|
||||
|
@ -139,18 +139,19 @@ int root_mount_path(const char *path, unsigned int flags)
|
|||
int root_state = NSITEM_MOUNTED | (flags & (NSITEM_HIDDEN|NSITEM_CONTENTS));
|
||||
set_root_item_state(ROOT_CONTENTS_INDEX, root_state);
|
||||
flags |= state; /* preserve the state of the mounted volume */
|
||||
if (!folder)
|
||||
{
|
||||
folder = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*if a folder has been enumerated don't mark the whole volume */
|
||||
if (folder[0] != '\0' && folder[1] != '\0')
|
||||
flags &= ~NSITEM_CONTENTS;
|
||||
|
||||
if (folder)
|
||||
{
|
||||
while (*folder == PATH_SEPCH)
|
||||
folder++;
|
||||
/*if a folder has been enumerated don't mark the whole volume */
|
||||
if (folder[0] != '\0')
|
||||
flags &= ~NSITEM_CONTENTS;
|
||||
else
|
||||
folder = NULL; /*Ensure separator is added by path_append */
|
||||
}
|
||||
snprintf(root_realpath_internal(), ROOT_MAX_REALPATH,"%s%s", volname, folder);
|
||||
|
||||
path_append(root_realpath_internal(), volname, folder, ROOT_MAX_REALPATH);
|
||||
}
|
||||
else if (state) /* error volume already mounted */
|
||||
return -EBUSY;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue