[PATCH 10/20] dosfs/msdos_file.c: Return an error if it occurs

Joel Sherrill joel.sherrill at oarcorp.com
Wed Nov 26 15:27:48 UTC 2014


On 11/26/2014 09:22 AM, Gedare Bloom wrote:
> Just a general comment that I think it better to have the last line be
> the "good" return value, that is, check for an error and return EIO,
> otherwise default to return RC_OK. Usually you want to have errors
> cause short-circuits, while non-error execution proceeds to the end.
>
Got that one. Will commit in the next batch.

Thanks.
> On Tue, Nov 25, 2014 at 6:02 PM, Joel Sherrill
> <joel.sherrill at oarcorp.com>  wrote:
>> From: Josh Oguin<josh.oguin at oarcorp.com>
>>
>> CodeSonar flagged this as a case where the return value from fat_sync()
>> was not used. Now it is used to return pass/fail to the caller.
>> ---
>>   cpukit/libfs/src/dosfs/msdos_file.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c
>> index 7a09272..1d62886 100644
>> --- a/cpukit/libfs/src/dosfs/msdos_file.c
>> +++ b/cpukit/libfs/src/dosfs/msdos_file.c
>> @@ -244,5 +244,8 @@ msdos_file_sync(rtems_libio_t *iop)
>>       rc = fat_sync(&fs_info->fat);
>>
>>       rtems_semaphore_release(fs_info->vol_sema);
>> -    return RC_OK;
>> +    if ( rc == 0 )
>> +      return RC_OK;
>> +
>> +    rtems_set_errno_and_return_minus_one(EIO);
>>   }
>> --
>> 1.9.3
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel




More information about the devel mailing list