diff options
| author | [email protected] <[email protected]> | 2012-12-28 13:40:52 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-12-28 13:40:52 +0000 |
| commit | 1c419d428ed5c3ae5dc6a38583f3b8bf1f94bb87 (patch) | |
| tree | bbc509a130b74c68448cd49fe663048586dc7edd /components/dfs/src | |
| parent | 1c56553b04478225b591cd4c1235827d080878bc (diff) | |
check dfs_fd valid in close
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2539 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/dfs/src')
| -rw-r--r-- | components/dfs/src/dfs_posix.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index 2ccc1541d5..d658f08265 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -86,6 +86,13 @@ int close(int fd) return -1;
}
+ /* check dfs_fd valid or not */
+ if (d->path == RT_NULL || d->ref_count == 0)
+ {
+ rt_set_errno(-DFS_STATUS_EBADF);
+ return -1;
+ }
+
result = dfs_file_close(d);
fd_put(d);
|
