fs/hostfs/hostfs.c: Support remote directory names without a trailing '/'
This commit is contained in:
parent
be542d530a
commit
8c4cf3f2c9
@ -931,7 +931,7 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
options = (const char *) data;
|
options = (const char *) data;
|
||||||
if ((strncmp(options, "fs=", 3) != 0) || (strlen(options) < 5))
|
if ((strncmp(options, "fs=", 3) != 0) || (strlen(options) < 4))
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
@ -973,7 +973,7 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
|
|||||||
|
|
||||||
strncpy(fs->fs_root, &options[3], sizeof(fs->fs_root));
|
strncpy(fs->fs_root, &options[3], sizeof(fs->fs_root));
|
||||||
len = strlen(fs->fs_root);
|
len = strlen(fs->fs_root);
|
||||||
if (len && fs->fs_root[len-1] == '/')
|
if (len > 1 && fs->fs_root[len - 1] == '/')
|
||||||
{
|
{
|
||||||
/* Remove trailing '/' */
|
/* Remove trailing '/' */
|
||||||
|
|
||||||
@ -992,7 +992,10 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data,
|
|||||||
|
|
||||||
/* Append a '/' to the name now */
|
/* Append a '/' to the name now */
|
||||||
|
|
||||||
|
if (fs->fs_root[len-1] != '/')
|
||||||
|
{
|
||||||
strcat(fs->fs_root, "/");
|
strcat(fs->fs_root, "/");
|
||||||
|
}
|
||||||
|
|
||||||
*handle = (FAR void *)fs;
|
*handle = (FAR void *)fs;
|
||||||
hostfs_semgive(fs);
|
hostfs_semgive(fs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user