Changeset 0d32490 in rtems


Ignore:
Timestamp:
Aug 25, 2009, 1:45:30 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
6749520
Parents:
eef91af
Message:

2009-08-25 Joel Sherrill <joel.sherrill@…>

  • 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.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    reef91af r0d32490  
     12009-08-25      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * libfs/src/devfs/devfs_eval.c: Fix bug where use of strncmp() resulted
     4        in a partial match being considered a full name match. On ERC32,
     5        looking for /dev/console would match /dev/console_b first.
     6
    172009-08-21      Roxana Leontie <roxana.leontie@gmail.com>
    28
  • cpukit/libfs/src/devfs/devfs_eval.c

    reef91af r0d32490  
    2323)
    2424{
    25     int                   i;
    26     rtems_device_name_t  *device_name_table;
     25  int                   i;
     26  rtems_device_name_t  *device_name_table;
    2727
    28     /* see if 'flags' is valid */
    29     if ( !rtems_libio_is_valid_perms( flags ) ) {
    30         assert( 0 );
    31         rtems_set_errno_and_return_minus_one( EIO );
    32     }
     28  /* see if 'flags' is valid */
     29  if ( !rtems_libio_is_valid_perms( flags ) ) {
     30     assert( 0 );
     31     rtems_set_errno_and_return_minus_one( EIO );
     32  }
    3333
    34     /* get the device name table */
    35     device_name_table = (rtems_device_name_t *)pathloc->node_access;
    36     if (!device_name_table)
    37         rtems_set_errno_and_return_minus_one( EFAULT );
     34  /* get the device name table */
     35  device_name_table = (rtems_device_name_t *)pathloc->node_access;
     36  if (!device_name_table)
     37    rtems_set_errno_and_return_minus_one( EFAULT );
    3838
    39     for (i = 0; i < rtems_device_table_size; i++){
    40         if ((device_name_table[i].device_name) &&
    41                 (strncmp(pathname, device_name_table[i].device_name, pathnamelen) == 0)){
    42             /* find the device, set proper values */
    43             pathloc->node_access = (void *)&device_name_table[i];
    44             pathloc->handlers = &devFS_file_handlers;
    45             pathloc->ops = &devFS_ops;
    46             pathloc->mt_entry = rtems_filesystem_root.mt_entry;
    47             return 0;
    48         }
    49     }
    50     /* no such file or directory */
    51     rtems_set_errno_and_return_minus_one( ENOENT );
     39  for (i = 0; i < rtems_device_table_size; i++) {
     40    if (!device_name_table[i].device_name)
     41      continue;
     42
     43    if (strncmp(pathname, device_name_table[i].device_name, pathnamelen) != 0)
     44      continue;
     45
     46    if (device_name_table[i].device_name[pathnamelen] != '\0')
     47      continue;
     48
     49    /* find the device, set proper values */
     50    pathloc->node_access = (void *)&device_name_table[i];
     51    pathloc->handlers = &devFS_file_handlers;
     52    pathloc->ops = &devFS_ops;
     53    pathloc->mt_entry = rtems_filesystem_root.mt_entry;
     54    return 0;
     55  }
     56
     57  /* no such file or directory */
     58  rtems_set_errno_and_return_minus_one( ENOENT );
    5259}
    5360
Note: See TracChangeset for help on using the changeset viewer.