Skip to content

Commit

Permalink
Merge pull request #463 from jphickey/fix-454-statvfs-err-translation
Browse files Browse the repository at this point in the history
Fix #454, Better error translation on statvfs()
  • Loading branch information
astrogeco authored May 26, 2020
2 parents f5a7224 + 45c9742 commit 51ba5aa
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/os/rtems/src/os-impl-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,34 @@ int32 OS_FileSysStatVolume_Impl (uint32 filesys_id, OS_statvfs_t *result)
{
OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id];
struct statvfs stat_buf;
int32 return_code;

if ( statvfs(local->system_mountpt, &stat_buf) != 0 )
{
return OS_ERROR;
/*
* The ENOSYS error means it is not implemented at the system level.
* This should translate to the OS_ERR_NOT_IMPLEMENTED OSAL code.
*/
if (errno == ENOSYS)
{
return_code = OS_ERR_NOT_IMPLEMENTED;
}
else
{
OS_DEBUG("%s: %s\n", local->system_mountpt, strerror(errno));
return_code = OS_ERROR;
}
}
else
{
result->block_size = stat_buf.f_bsize;
result->blocks_free = stat_buf.f_bfree;
result->total_blocks = stat_buf.f_blocks;

result->block_size = stat_buf.f_bsize;
result->blocks_free = stat_buf.f_bfree;
result->total_blocks = stat_buf.f_blocks;
return_code = OS_SUCCESS;
}

return(OS_SUCCESS);
return (return_code);
} /* end OS_FileSysStatVolume_Impl */


Expand Down

0 comments on commit 51ba5aa

Please sign in to comment.