forked from Imagelibrary/rtems
Corrected spacing and added some new error checks that were needed
to avoid dereferencing NULLs.
This commit is contained in:
@@ -101,20 +101,25 @@ int mount(
|
||||
/* 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 ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
|
||||
if ( fs_ops == NULL ) {
|
||||
errno = EINVAL;
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
@@ -125,6 +130,11 @@ int mount(
|
||||
|
||||
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->options = options;
|
||||
if ( device )
|
||||
|
||||
@@ -103,8 +103,8 @@ int open(
|
||||
* See if the file exists.
|
||||
*/
|
||||
|
||||
|
||||
status = rtems_filesystem_evaluate_path( pathname, eval_flags, &temp_loc, TRUE );
|
||||
status = rtems_filesystem_evaluate_path(
|
||||
pathname, eval_flags, &temp_loc, TRUE );
|
||||
|
||||
if ( status == -1 ) {
|
||||
if ( errno != ENOENT ) {
|
||||
|
||||
@@ -101,20 +101,25 @@ int mount(
|
||||
/* 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 ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
|
||||
if ( fs_ops == NULL ) {
|
||||
errno = EINVAL;
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
@@ -125,6 +130,11 @@ int mount(
|
||||
|
||||
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->options = options;
|
||||
if ( device )
|
||||
|
||||
@@ -103,8 +103,8 @@ int open(
|
||||
* See if the file exists.
|
||||
*/
|
||||
|
||||
|
||||
status = rtems_filesystem_evaluate_path( pathname, eval_flags, &temp_loc, TRUE );
|
||||
status = rtems_filesystem_evaluate_path(
|
||||
pathname, eval_flags, &temp_loc, TRUE );
|
||||
|
||||
if ( status == -1 ) {
|
||||
if ( errno != ENOENT ) {
|
||||
|
||||
@@ -101,20 +101,25 @@ int mount(
|
||||
/* 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 ( options == RTEMS_FILESYSTEM_BAD_OPTIONS ){
|
||||
if ( fs_ops == NULL ) {
|
||||
errno = EINVAL;
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
@@ -125,6 +130,11 @@ int mount(
|
||||
|
||||
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->options = options;
|
||||
if ( device )
|
||||
|
||||
@@ -103,8 +103,8 @@ int open(
|
||||
* See if the file exists.
|
||||
*/
|
||||
|
||||
|
||||
status = rtems_filesystem_evaluate_path( pathname, eval_flags, &temp_loc, TRUE );
|
||||
status = rtems_filesystem_evaluate_path(
|
||||
pathname, eval_flags, &temp_loc, TRUE );
|
||||
|
||||
if ( status == -1 ) {
|
||||
if ( errno != ENOENT ) {
|
||||
|
||||
Reference in New Issue
Block a user