2011-04-16 Chris Johns <chrisj@rtems.org>

PR 1774/filesystem
        * libfs/src/imfs/imfs_eval.c: Fix the IMFS eval and eval for make
        handlers to not inspect a mounted file sytems path.
This commit is contained in:
Chris Johns
2011-04-16 03:47:32 +00:00
parent 17cc97db97
commit ec9d486333
2 changed files with 66 additions and 58 deletions

View File

@@ -1,3 +1,9 @@
2011-04-16 Chris Johns <chrisj@rtems.org>
PR 1774/filesystem
* libfs/src/imfs/imfs_eval.c: Fix the IMFS eval and eval for make
handlers to not inspect a mounted file sytems path.
2011-04-04 Sebastien Bourdeauducq <sebastien.bourdeauducq@gmail.com>
PR 1722/networking

View File

@@ -306,6 +306,7 @@ int IMFS_evaluate_for_make(
* Get the path length.
*/
pathlen = strlen( path );
/*
* Evaluate all tokens until we are done or an error occurs.
*/
@@ -345,7 +346,8 @@ int IMFS_evaluate_for_make(
* Am I at the root of this mounted filesystem?
*/
if (pathloc->node_access == pathloc->mt_entry->mt_fs_root.node_access){
if (pathloc->node_access ==
pathloc->mt_entry->mt_fs_root.node_access){
/*
* Am I at the root of all filesystems?
@@ -353,14 +355,12 @@ int IMFS_evaluate_for_make(
if ( pathloc->node_access == rtems_filesystem_root.node_access ) {
break;
} else {
newloc = pathloc->mt_entry->mt_point_node;
*pathloc = newloc;
return (*pathloc->ops->evalformake_h)( &path[i-len], pathloc, name );
return (*pathloc->ops->evalformake_h)( &path[i], pathloc, name );
}
} else {
if ( !node->Parent )
rtems_set_errno_and_return_minus_one( ENOENT );
@@ -371,6 +371,9 @@ int IMFS_evaluate_for_make(
break;
case IMFS_NAME:
/*
* If we are at a link follow it.
*/
if ( node->type == IMFS_HARD_LINK ) {
@@ -397,17 +400,6 @@ int IMFS_evaluate_for_make(
if ( node->type != IMFS_DIRECTORY )
rtems_set_errno_and_return_minus_one( ENOTDIR );
/*
* If we are at a node that is a mount point. Set loc to the
* new fs root node and let them finish evaluating the path.
*/
if ( node->info.directory.mt_fs != NULL ) {
newloc = node->info.directory.mt_fs->mt_fs_root;
*pathloc = newloc;
return (*pathloc->ops->evalformake_h)( &path[i-len], pathloc, name );
}
/*
* Otherwise find the token name in the present location.
*/
@@ -421,9 +413,20 @@ int IMFS_evaluate_for_make(
if ( ! node )
done = true;
else
pathloc->node_access = node;
else {
/*
* If we are at a node that is a mount point. Set loc to the
* new fs root node and let them finish evaluating the path.
*/
if ( node->info.directory.mt_fs != NULL ) {
newloc = node->info.directory.mt_fs->mt_fs_root;
*pathloc = newloc;
return (*pathloc->ops->evalformake_h)( &path[i], pathloc, name );
}
pathloc->node_access = node;
}
break;
case IMFS_NO_MORE_PATH:
@@ -558,18 +561,15 @@ int IMFS_eval_path(
} else {
newloc = pathloc->mt_entry->mt_point_node;
*pathloc = newloc;
return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),
pathnamelen+len,
return (*pathloc->ops->evalpath_h)(&(pathname[i]),
pathnamelen,
flags,pathloc);
}
} else {
if ( !node->Parent )
rtems_set_errno_and_return_minus_one( ENOENT );
node = node->Parent;
pathloc->node_access = node;
}
pathloc->node_access = node;
@@ -604,6 +604,22 @@ int IMFS_eval_path(
if ( node->type != IMFS_DIRECTORY )
rtems_set_errno_and_return_minus_one( ENOTDIR );
/*
* Otherwise find the token name in the present location.
*/
node = IMFS_find_match_in_dir( node, token );
if ( !node )
rtems_set_errno_and_return_minus_one( ENOENT );
/*
* Set the node access to the point we have found.
*/
pathloc->node_access = node;
/*
* If we are at a node that is a mount point. Set loc to the
* new fs root node and let them finish evaluating the path.
@@ -612,24 +628,10 @@ int IMFS_eval_path(
if ( node->info.directory.mt_fs != NULL ) {
newloc = node->info.directory.mt_fs->mt_fs_root;
*pathloc = newloc;
return (*pathloc->ops->evalpath_h)( &pathname[i-len],
pathnamelen+len,
return (*pathloc->ops->evalpath_h)( &pathname[i],
pathnamelen,
flags, pathloc );
}
/*
* Otherwise find the token name in the present location.
*/
node = IMFS_find_match_in_dir( node, token );
if ( !node )
rtems_set_errno_and_return_minus_one( ENOENT );
/*
* Set the node access to the point we have found.
*/
pathloc->node_access = node;
break;
case IMFS_NO_MORE_PATH: