summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-25 13:45:30 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-25 13:45:30 +0000
commit0d324900255062edd3f7661adb1969a4c71b591c (patch)
treecc359690115769657f0f2f3fb771d547458be99f /cpukit
parent2009-08-24 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-0d324900255062edd3f7661adb1969a4c71b591c.tar.bz2
2009-08-25 Joel Sherrill <joel.sherrill@OARcorp.com>
* libfs/src/devfs/devfs_eval.c: Fix bug where use of strncmp() resulted in a partial match being considered a full name match. On ERC32, looking for /dev/console would match /dev/console_b first.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog6
-rw-r--r--cpukit/libfs/src/devfs/devfs_eval.c55
2 files changed, 37 insertions, 24 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 52d48dc49e..6525c23c25 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-25 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * libfs/src/devfs/devfs_eval.c: Fix bug where use of strncmp() resulted
+ in a partial match being considered a full name match. On ERC32,
+ looking for /dev/console would match /dev/console_b first.
+
2009-08-21 Roxana Leontie <roxana.leontie@gmail.com>
* Makefile.am, preinstall.am, libmisc/Makefile.am: Changed the name of
diff --git a/cpukit/libfs/src/devfs/devfs_eval.c b/cpukit/libfs/src/devfs/devfs_eval.c
index dd69fd802d..d86bd9eb8c 100644
--- a/cpukit/libfs/src/devfs/devfs_eval.c
+++ b/cpukit/libfs/src/devfs/devfs_eval.c
@@ -22,33 +22,40 @@ int devFS_evaluate_path(
rtems_filesystem_location_info_t *pathloc
)
{
- int i;
- rtems_device_name_t *device_name_table;
+ int i;
+ rtems_device_name_t *device_name_table;
- /* see if 'flags' is valid */
- if ( !rtems_libio_is_valid_perms( flags ) ) {
- assert( 0 );
- rtems_set_errno_and_return_minus_one( EIO );
- }
+ /* see if 'flags' is valid */
+ if ( !rtems_libio_is_valid_perms( flags ) ) {
+ assert( 0 );
+ rtems_set_errno_and_return_minus_one( EIO );
+ }
- /* get the device name table */
- device_name_table = (rtems_device_name_t *)pathloc->node_access;
- if (!device_name_table)
- rtems_set_errno_and_return_minus_one( EFAULT );
+ /* get the device name table */
+ device_name_table = (rtems_device_name_t *)pathloc->node_access;
+ if (!device_name_table)
+ rtems_set_errno_and_return_minus_one( EFAULT );
- for (i = 0; i < rtems_device_table_size; i++){
- if ((device_name_table[i].device_name) &&
- (strncmp(pathname, device_name_table[i].device_name, pathnamelen) == 0)){
- /* find the device, set proper values */
- pathloc->node_access = (void *)&device_name_table[i];
- pathloc->handlers = &devFS_file_handlers;
- pathloc->ops = &devFS_ops;
- pathloc->mt_entry = rtems_filesystem_root.mt_entry;
- return 0;
- }
- }
- /* no such file or directory */
- rtems_set_errno_and_return_minus_one( ENOENT );
+ for (i = 0; i < rtems_device_table_size; i++) {
+ if (!device_name_table[i].device_name)
+ continue;
+
+ if (strncmp(pathname, device_name_table[i].device_name, pathnamelen) != 0)
+ continue;
+
+ if (device_name_table[i].device_name[pathnamelen] != '\0')
+ continue;
+
+ /* find the device, set proper values */
+ pathloc->node_access = (void *)&device_name_table[i];
+ pathloc->handlers = &devFS_file_handlers;
+ pathloc->ops = &devFS_ops;
+ pathloc->mt_entry = rtems_filesystem_root.mt_entry;
+ return 0;
+ }
+
+ /* no such file or directory */
+ rtems_set_errno_and_return_minus_one( ENOENT );
}