Changeset 2f87c843 in rtems for c/src/lib/libc/mount.c


Ignore:
Timestamp:
Feb 5, 1999, 12:28:43 AM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
ecec2ba
Parents:
e824fa5
Message:

Corrected spacing and added some new error checks that were needed
to avoid dereferencing NULLs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libc/mount.c

    re824fa5 r2f87c843  
    102102
    103103  /*
    104    *  Are the file system options valid?
    105    */
    106 
    107   options = get_file_system_options( fsoptions );
    108   if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
     104   *  Is there a file system operations table?
     105   */
     106
     107  if ( fs_ops == NULL ) {
    109108    errno = EINVAL;
    110109    return -1;
     
    112111
    113112  /*
    114    *  Is the file system type valid?
    115    */
    116 
    117   if ( fs_ops == NULL ){
     113   *  Are the file system options valid?
     114   */
     115
     116  if ( fsoptions == NULL ) {
    118117    errno = EINVAL;
    119118    return -1;
    120119  }
    121120
     121  options = get_file_system_options( fsoptions );
     122  if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ) {
     123    errno = EINVAL;
     124    return -1;
     125  }
     126
    122127  /*
    123128   * Allocate a mount table entry
     
    125130
    126131   temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) );
     132
     133   if ( !temp_mt_entry ) {
     134     errno = ENOMEM;
     135     return -1;
     136   }
    127137
    128138   temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
    129139   temp_mt_entry->options = options;
    130    if( device )
    131       sprintf( temp_mt_entry->dev, "%s", device );
     140   if ( device )
     141     sprintf( temp_mt_entry->dev, "%s", device );
    132142   else
    133       temp_mt_entry->dev = 0;
     143     temp_mt_entry->dev = 0;
    134144
    135145  /*
     
    150160      */
    151161
    152      if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
     162     if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
    153163       errno = ENOTDIR;
    154164       goto cleanup_and_bail;
     
    159169      */
    160170
    161      if ( search_mt_for_mount_point( &temp_loc ) == FOUND ){
     171     if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
    162172       errno = EBUSY;
    163173       goto cleanup_and_bail;
     
    180190
    181191     if ( !temp_loc.ops->mount ){
    182       errno = ENOTSUP;
    183       goto cleanup_and_bail;
     192       errno = ENOTSUP;
     193       goto cleanup_and_bail;
    184194     }
    185195
     
    283293)
    284294{
    285   Chain_Node  *the_node;
     295  Chain_Node                           *the_node;
    286296  rtems_filesystem_mount_table_entry_t *the_mount_entry;
    287297
Note: See TracChangeset for help on using the changeset viewer.