Fixed invalid root handling by the VFS streams driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15455 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
523cb5fb4c
commit
3cf08662ea
|
@ -222,7 +222,7 @@ static msg_t open_absolute_dir(vfs_overlay_driver_c *drvp,
|
|||
if (!CH_RET_IS_ERROR(ret)) {
|
||||
/* Delegating node creation to a registered driver.*/
|
||||
ret = dp->vmt->open_dir((void *)dp,
|
||||
scanpath,
|
||||
*scanpath == '\0' ? "/" : scanpath,
|
||||
vdnpp);
|
||||
}
|
||||
else {
|
||||
|
@ -285,8 +285,11 @@ static msg_t open_absolute_file(vfs_overlay_driver_c *drvp,
|
|||
/* Searching for a match among registered overlays.*/
|
||||
ret = match_driver(drvp, &scanpath, &dp);
|
||||
if (!CH_RET_IS_ERROR(ret)) {
|
||||
/* Delegating node creation to a registered driver.*/
|
||||
ret = dp->vmt->open_file((void *)dp, scanpath, oflag, vfnpp);
|
||||
/* Delegating node creation to a registered driver, making sure it
|
||||
does not receive an empty path.*/
|
||||
ret = dp->vmt->open_file((void *)dp,
|
||||
*scanpath == '\0' ? "/" : scanpath,
|
||||
oflag, vfnpp);
|
||||
}
|
||||
else {
|
||||
/* Is there an overlaid driver? if so we need to pass request
|
||||
|
|
|
@ -204,9 +204,16 @@ static msg_t drv_open_file(void *instance,
|
|||
err = vfs_parse_match_separator(&path);
|
||||
CH_BREAK_ON_ERROR(err);
|
||||
|
||||
err = path_get_element(&path, fname, VFS_CFG_NAMELEN_MAX + 1);
|
||||
err = (msg_t)path_get_element(&path, fname, VFS_CFG_NAMELEN_MAX + 1);
|
||||
CH_BREAK_ON_ERROR(err);
|
||||
|
||||
/* Null element.*/
|
||||
if (err == (msg_t)0) {
|
||||
/* Trying to open the root as a file.*/
|
||||
err = CH_RET_EISDIR;
|
||||
break;
|
||||
}
|
||||
|
||||
err = vfs_parse_match_end(&path);
|
||||
CH_BREAK_ON_ERROR(err);
|
||||
|
||||
|
|
Loading…
Reference in New Issue