Corrected spacing and added some new error checks that were needed

to avoid dereferencing NULLs.
This commit is contained in:
Joel Sherrill
1999-02-05 00:28:43 +00:00
parent e824fa5073
commit 2f87c84349
10 changed files with 111 additions and 81 deletions

View File

@@ -101,20 +101,25 @@ int mount(
/* XXX add code to check for required operations */ /* XXX add code to check for required operations */
/* /*
* Are the file system options valid? * Is there a file system operations table?
*/ */
options = get_file_system_options( fsoptions ); if ( fs_ops == NULL ) {
if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
/* /*
* Is the file system type valid? * Are the file system options valid?
*/ */
if ( fs_ops == NULL ){ if ( fsoptions == NULL ) {
errno = EINVAL;
return -1;
}
options = get_file_system_options( fsoptions );
if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
@@ -125,12 +130,17 @@ int mount(
temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) ); temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) );
if ( !temp_mt_entry ) {
errno = ENOMEM;
return -1;
}
temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry; temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
temp_mt_entry->options = options; temp_mt_entry->options = options;
if( device ) if ( device )
sprintf( temp_mt_entry->dev, "%s", device ); sprintf( temp_mt_entry->dev, "%s", device );
else else
temp_mt_entry->dev = 0; temp_mt_entry->dev = 0;
/* /*
* The mount_point should be a directory with read/write/execute * The mount_point should be a directory with read/write/execute
@@ -149,7 +159,7 @@ int mount(
* Test to see if it is a directory * Test to see if it is a directory
*/ */
if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
errno = ENOTDIR; errno = ENOTDIR;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
@@ -158,7 +168,7 @@ int mount(
* You can only mount one file system onto a single mount point. * You can only mount one file system onto a single mount point.
*/ */
if ( search_mt_for_mount_point( &temp_loc ) == FOUND ){ if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
errno = EBUSY; errno = EBUSY;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
@@ -179,8 +189,8 @@ int mount(
*/ */
if ( !temp_loc.ops->mount ){ if ( !temp_loc.ops->mount ){
errno = ENOTSUP; errno = ENOTSUP;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
if ( temp_loc.ops->mount( temp_mt_entry ) ) { if ( temp_loc.ops->mount( temp_mt_entry ) ) {
@@ -282,7 +292,7 @@ int search_mt_for_mount_point(
rtems_filesystem_location_info_t *location_of_mount_point rtems_filesystem_location_info_t *location_of_mount_point
) )
{ {
Chain_Node *the_node; Chain_Node *the_node;
rtems_filesystem_mount_table_entry_t *the_mount_entry; rtems_filesystem_mount_table_entry_t *the_mount_entry;
for ( the_node = rtems_filesystem_mount_table_control.first; for ( the_node = rtems_filesystem_mount_table_control.first;

View File

@@ -103,8 +103,8 @@ int open(
* See if the file exists. * See if the file exists.
*/ */
status = rtems_filesystem_evaluate_path(
status = rtems_filesystem_evaluate_path( pathname, eval_flags, &temp_loc, TRUE ); pathname, eval_flags, &temp_loc, TRUE );
if ( status == -1 ) { if ( status == -1 ) {
if ( errno != ENOENT ) { if ( errno != ENOENT ) {

View File

@@ -70,7 +70,7 @@ int IMFS_evaluate_permission(
IMFS_jnode_t *jnode; IMFS_jnode_t *jnode;
int flags_to_test; int flags_to_test;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -141,7 +141,7 @@ int IMFS_evaluate_hard_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -203,7 +203,7 @@ int IMFS_evaluate_sym_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -307,7 +307,7 @@ int IMFS_evaluate_for_make(
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -422,7 +422,7 @@ int IMFS_evaluate_for_make(
*/ */
for( ; path[i] != '\0'; i++) { for( ; path[i] != '\0'; i++) {
if (! IMFS_is_separator( path[ i ] ) ) if ( !IMFS_is_separator( path[ i ] ) )
set_errno_and_return_minus_one( ENOENT ); set_errno_and_return_minus_one( ENOENT );
} }
@@ -443,7 +443,7 @@ int IMFS_evaluate_for_make(
* We must have Write and execute permission on the returned node. * We must have Write and execute permission on the returned node.
*/ */
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -472,7 +472,7 @@ int IMFS_eval_path(
IMFS_jnode_t *node; IMFS_jnode_t *node;
int result; int result;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -501,7 +501,7 @@ int IMFS_eval_path(
*/ */
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -622,7 +622,7 @@ int IMFS_eval_path(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( pathloc, flags ) ) if ( !IMFS_evaluate_permission( pathloc, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;

View File

@@ -70,7 +70,7 @@ int IMFS_evaluate_permission(
IMFS_jnode_t *jnode; IMFS_jnode_t *jnode;
int flags_to_test; int flags_to_test;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -141,7 +141,7 @@ int IMFS_evaluate_hard_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -203,7 +203,7 @@ int IMFS_evaluate_sym_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -307,7 +307,7 @@ int IMFS_evaluate_for_make(
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -422,7 +422,7 @@ int IMFS_evaluate_for_make(
*/ */
for( ; path[i] != '\0'; i++) { for( ; path[i] != '\0'; i++) {
if (! IMFS_is_separator( path[ i ] ) ) if ( !IMFS_is_separator( path[ i ] ) )
set_errno_and_return_minus_one( ENOENT ); set_errno_and_return_minus_one( ENOENT );
} }
@@ -443,7 +443,7 @@ int IMFS_evaluate_for_make(
* We must have Write and execute permission on the returned node. * We must have Write and execute permission on the returned node.
*/ */
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -472,7 +472,7 @@ int IMFS_eval_path(
IMFS_jnode_t *node; IMFS_jnode_t *node;
int result; int result;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -501,7 +501,7 @@ int IMFS_eval_path(
*/ */
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -622,7 +622,7 @@ int IMFS_eval_path(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( pathloc, flags ) ) if ( !IMFS_evaluate_permission( pathloc, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;

View File

@@ -101,20 +101,25 @@ int mount(
/* XXX add code to check for required operations */ /* XXX add code to check for required operations */
/* /*
* Are the file system options valid? * Is there a file system operations table?
*/ */
options = get_file_system_options( fsoptions ); if ( fs_ops == NULL ) {
if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
/* /*
* Is the file system type valid? * Are the file system options valid?
*/ */
if ( fs_ops == NULL ){ if ( fsoptions == NULL ) {
errno = EINVAL;
return -1;
}
options = get_file_system_options( fsoptions );
if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
@@ -125,12 +130,17 @@ int mount(
temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) ); temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) );
if ( !temp_mt_entry ) {
errno = ENOMEM;
return -1;
}
temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry; temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
temp_mt_entry->options = options; temp_mt_entry->options = options;
if( device ) if ( device )
sprintf( temp_mt_entry->dev, "%s", device ); sprintf( temp_mt_entry->dev, "%s", device );
else else
temp_mt_entry->dev = 0; temp_mt_entry->dev = 0;
/* /*
* The mount_point should be a directory with read/write/execute * The mount_point should be a directory with read/write/execute
@@ -149,7 +159,7 @@ int mount(
* Test to see if it is a directory * Test to see if it is a directory
*/ */
if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
errno = ENOTDIR; errno = ENOTDIR;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
@@ -158,7 +168,7 @@ int mount(
* You can only mount one file system onto a single mount point. * You can only mount one file system onto a single mount point.
*/ */
if ( search_mt_for_mount_point( &temp_loc ) == FOUND ){ if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
errno = EBUSY; errno = EBUSY;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
@@ -179,8 +189,8 @@ int mount(
*/ */
if ( !temp_loc.ops->mount ){ if ( !temp_loc.ops->mount ){
errno = ENOTSUP; errno = ENOTSUP;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
if ( temp_loc.ops->mount( temp_mt_entry ) ) { if ( temp_loc.ops->mount( temp_mt_entry ) ) {
@@ -282,7 +292,7 @@ int search_mt_for_mount_point(
rtems_filesystem_location_info_t *location_of_mount_point rtems_filesystem_location_info_t *location_of_mount_point
) )
{ {
Chain_Node *the_node; Chain_Node *the_node;
rtems_filesystem_mount_table_entry_t *the_mount_entry; rtems_filesystem_mount_table_entry_t *the_mount_entry;
for ( the_node = rtems_filesystem_mount_table_control.first; for ( the_node = rtems_filesystem_mount_table_control.first;

View File

@@ -103,8 +103,8 @@ int open(
* See if the file exists. * See if the file exists.
*/ */
status = rtems_filesystem_evaluate_path(
status = rtems_filesystem_evaluate_path( pathname, eval_flags, &temp_loc, TRUE ); pathname, eval_flags, &temp_loc, TRUE );
if ( status == -1 ) { if ( status == -1 ) {
if ( errno != ENOENT ) { if ( errno != ENOENT ) {

View File

@@ -70,7 +70,7 @@ int IMFS_evaluate_permission(
IMFS_jnode_t *jnode; IMFS_jnode_t *jnode;
int flags_to_test; int flags_to_test;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -141,7 +141,7 @@ int IMFS_evaluate_hard_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -203,7 +203,7 @@ int IMFS_evaluate_sym_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -307,7 +307,7 @@ int IMFS_evaluate_for_make(
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -422,7 +422,7 @@ int IMFS_evaluate_for_make(
*/ */
for( ; path[i] != '\0'; i++) { for( ; path[i] != '\0'; i++) {
if (! IMFS_is_separator( path[ i ] ) ) if ( !IMFS_is_separator( path[ i ] ) )
set_errno_and_return_minus_one( ENOENT ); set_errno_and_return_minus_one( ENOENT );
} }
@@ -443,7 +443,7 @@ int IMFS_evaluate_for_make(
* We must have Write and execute permission on the returned node. * We must have Write and execute permission on the returned node.
*/ */
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -472,7 +472,7 @@ int IMFS_eval_path(
IMFS_jnode_t *node; IMFS_jnode_t *node;
int result; int result;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -501,7 +501,7 @@ int IMFS_eval_path(
*/ */
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -622,7 +622,7 @@ int IMFS_eval_path(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( pathloc, flags ) ) if ( !IMFS_evaluate_permission( pathloc, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;

View File

@@ -101,20 +101,25 @@ int mount(
/* XXX add code to check for required operations */ /* XXX add code to check for required operations */
/* /*
* Are the file system options valid? * Is there a file system operations table?
*/ */
options = get_file_system_options( fsoptions ); if ( fs_ops == NULL ) {
if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
/* /*
* Is the file system type valid? * Are the file system options valid?
*/ */
if ( fs_ops == NULL ){ if ( fsoptions == NULL ) {
errno = EINVAL;
return -1;
}
options = get_file_system_options( fsoptions );
if ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
@@ -125,12 +130,17 @@ int mount(
temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) ); temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) );
if ( !temp_mt_entry ) {
errno = ENOMEM;
return -1;
}
temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry; temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
temp_mt_entry->options = options; temp_mt_entry->options = options;
if( device ) if ( device )
sprintf( temp_mt_entry->dev, "%s", device ); sprintf( temp_mt_entry->dev, "%s", device );
else else
temp_mt_entry->dev = 0; temp_mt_entry->dev = 0;
/* /*
* The mount_point should be a directory with read/write/execute * The mount_point should be a directory with read/write/execute
@@ -149,7 +159,7 @@ int mount(
* Test to see if it is a directory * Test to see if it is a directory
*/ */
if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
errno = ENOTDIR; errno = ENOTDIR;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
@@ -158,7 +168,7 @@ int mount(
* You can only mount one file system onto a single mount point. * You can only mount one file system onto a single mount point.
*/ */
if ( search_mt_for_mount_point( &temp_loc ) == FOUND ){ if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
errno = EBUSY; errno = EBUSY;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
@@ -179,8 +189,8 @@ int mount(
*/ */
if ( !temp_loc.ops->mount ){ if ( !temp_loc.ops->mount ){
errno = ENOTSUP; errno = ENOTSUP;
goto cleanup_and_bail; goto cleanup_and_bail;
} }
if ( temp_loc.ops->mount( temp_mt_entry ) ) { if ( temp_loc.ops->mount( temp_mt_entry ) ) {
@@ -282,7 +292,7 @@ int search_mt_for_mount_point(
rtems_filesystem_location_info_t *location_of_mount_point rtems_filesystem_location_info_t *location_of_mount_point
) )
{ {
Chain_Node *the_node; Chain_Node *the_node;
rtems_filesystem_mount_table_entry_t *the_mount_entry; rtems_filesystem_mount_table_entry_t *the_mount_entry;
for ( the_node = rtems_filesystem_mount_table_control.first; for ( the_node = rtems_filesystem_mount_table_control.first;

View File

@@ -103,8 +103,8 @@ int open(
* See if the file exists. * See if the file exists.
*/ */
status = rtems_filesystem_evaluate_path(
status = rtems_filesystem_evaluate_path( pathname, eval_flags, &temp_loc, TRUE ); pathname, eval_flags, &temp_loc, TRUE );
if ( status == -1 ) { if ( status == -1 ) {
if ( errno != ENOENT ) { if ( errno != ENOENT ) {

View File

@@ -70,7 +70,7 @@ int IMFS_evaluate_permission(
IMFS_jnode_t *jnode; IMFS_jnode_t *jnode;
int flags_to_test; int flags_to_test;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -141,7 +141,7 @@ int IMFS_evaluate_hard_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -203,7 +203,7 @@ int IMFS_evaluate_sym_link(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( node, flags ) ) if ( !IMFS_evaluate_permission( node, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -307,7 +307,7 @@ int IMFS_evaluate_for_make(
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -422,7 +422,7 @@ int IMFS_evaluate_for_make(
*/ */
for( ; path[i] != '\0'; i++) { for( ; path[i] != '\0'; i++) {
if (! IMFS_is_separator( path[ i ] ) ) if ( !IMFS_is_separator( path[ i ] ) )
set_errno_and_return_minus_one( ENOENT ); set_errno_and_return_minus_one( ENOENT );
} }
@@ -443,7 +443,7 @@ int IMFS_evaluate_for_make(
* We must have Write and execute permission on the returned node. * We must have Write and execute permission on the returned node.
*/ */
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;
@@ -472,7 +472,7 @@ int IMFS_eval_path(
IMFS_jnode_t *node; IMFS_jnode_t *node;
int result; int result;
if (! rtems_libio_is_valid_perms( flags ) ) { if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 ); assert( 0 );
set_errno_and_return_minus_one( EIO ); set_errno_and_return_minus_one( EIO );
} }
@@ -501,7 +501,7 @@ int IMFS_eval_path(
*/ */
if ( type != IMFS_NO_MORE_PATH ) if ( type != IMFS_NO_MORE_PATH )
if ( node->type == IMFS_DIRECTORY ) if ( node->type == IMFS_DIRECTORY )
if (! IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) ) if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
node = pathloc->node_access; node = pathloc->node_access;
@@ -622,7 +622,7 @@ int IMFS_eval_path(
* Verify we have the correct permissions for this node. * Verify we have the correct permissions for this node.
*/ */
if (! IMFS_evaluate_permission( pathloc, flags ) ) if ( !IMFS_evaluate_permission( pathloc, flags ) )
set_errno_and_return_minus_one( EACCES ); set_errno_and_return_minus_one( EACCES );
return result; return result;