[DFS] Add fd checking in dfs_file_close API.

This commit is contained in:
bernard 2017-06-06 18:19:32 +08:00
parent 8ee0bf8908
commit 3101ba8ac8
1 changed files with 4 additions and 0 deletions

View File

@ -136,6 +136,9 @@ int dfs_file_close(struct dfs_fd *fd)
{ {
int result = 0; int result = 0;
if (fd == RT_NULL)
return -DFS_STATUS_ENXIO;
if (fd != RT_NULL && fd->fs->ops->close != RT_NULL) if (fd != RT_NULL && fd->fs->ops->close != RT_NULL)
result = fd->fs->ops->close(fd); result = fd->fs->ops->close(fd);
@ -568,6 +571,7 @@ void rm(const char *filename)
} }
} }
FINSH_FUNCTION_EXPORT(rm, remove files or directories); FINSH_FUNCTION_EXPORT(rm, remove files or directories);
void cat(const char* filename) void cat(const char* filename)
{ {
rt_uint32_t length; rt_uint32_t length;