Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision a3ca5f366ffbd55a161bb3080ffa636f0b853dd6)
+++ cpukit/ChangeLog	(revision e0bc5437972ad26028bdc83fffe2850bc755706b)
@@ -1,4 +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-15	Sebastian Huber <sebastian.huber@embedded-brains.de>
-
 	* libcsupport/src/ioctl.c, libfs/src/pipe/fifo.c: Fixed integer type.
 
Index: cpukit/libfs/src/imfs/imfs_eval.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_eval.c	(revision a3ca5f366ffbd55a161bb3080ffa636f0b853dd6)
+++ cpukit/libfs/src/imfs/imfs_eval.c	(revision e0bc5437972ad26028bdc83fffe2850bc755706b)
@@ -293,4 +293,5 @@
    */
   pathlen = strlen( path );
+
   /*
    *  Evaluate all tokens until we are done or an error occurs.
@@ -322,5 +323,5 @@
        /*
         *  Am I at the root of all filesystems? (chroot'ed?)
-	*/
+        */
 
        if ( pathloc->node_access == rtems_filesystem_root.node_access )
@@ -328,29 +329,28 @@
 
 
-	/*
-	 * Am I at the root of this mounted filesystem?
-	 */
-
-        if (pathloc->node_access == pathloc->mt_entry->mt_fs_root.node_access){
+       /*
+        * Am I at the root of this mounted filesystem?
+        */
+
+        if (pathloc->node_access ==
+            pathloc->mt_entry->mt_fs_root.node_access){
 
           /*
-	   *  Am I at the root of all filesystems?
-	   */
+           *  Am I at the root of all filesystems?
+           */
 
           if ( pathloc->node_access == rtems_filesystem_root.node_access ) {
             break;
-
-	  } else {
+          } else {
             newloc = pathloc->mt_entry->mt_point_node;
             *pathloc = newloc;
-            return (*pathloc->ops->evalformake_h)( &path[i-len], pathloc, name );
-	  }
-	} else {
-
+            return (*pathloc->ops->evalformake_h)( &path[i], pathloc, name );
+          }
+        } else {
           if ( !node->Parent )
             rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
-	}
+        }
 
         pathloc->node_access = node;
@@ -358,6 +358,9 @@
 
       case IMFS_NAME:
-
-	if ( node->type == IMFS_HARD_LINK ) {
+        /*
+         *  If we are at a link follow it.
+         */
+
+        if ( node->type == IMFS_HARD_LINK ) {
 
           result = IMFS_evaluate_link( pathloc, 0 );
@@ -365,5 +368,5 @@
             return -1;
 
-	} else if ( node->type == IMFS_SYM_LINK ) {
+        } else if ( node->type == IMFS_SYM_LINK ) {
 
           result = IMFS_evaluate_link( pathloc, 0 );
@@ -371,5 +374,5 @@
           if ( result == -1 )
             return -1;
-	}
+        }
 
         node = pathloc->node_access;
@@ -379,36 +382,36 @@
         /*
          * Only a directory can be decended into.
-	 */
+         */
 
         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.
-	 */
+        /*
+         * Otherwise find the token name in the present location.
+         */
 
         node = IMFS_find_match_in_dir( node, token );
 
-	/*
-	 * If there is no node we have found the name of the node we
+        /*
+         * If there is no node we have found the name of the node we
          * wish to create.
-	 */
+         */
 
         if ( ! node )
           done = true;
-        else
+        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;
 
@@ -544,16 +547,13 @@
             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;
-
         }
 
@@ -565,15 +565,15 @@
          *  If we are at a link follow it.
          */
+
         if ( node->type == IMFS_HARD_LINK ) {
+
           IMFS_evaluate_hard_link( pathloc, 0 );
+
           node = pathloc->node_access;
-       
-          /*
-	   * It would be a design error if we evaluated the link and
-	   * was broken.
-	   */
-          IMFS_assert( node );
+          if ( !node )
+            rtems_set_errno_and_return_minus_one( ENOTDIR );
 
         } else if ( node->type == IMFS_SYM_LINK ) {
+
           result = IMFS_evaluate_sym_link( pathloc, 0 );
 
@@ -590,31 +590,35 @@
          *  Only a directory can be decended into.
          */
+
         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.
          */
+
         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;
 
