diff options
| author | [email protected] <[email protected]> | 2012-12-29 02:49:35 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-12-29 02:49:35 +0000 |
| commit | 911cbb5793ed66785443b359b2faee40bcaa49df (patch) | |
| tree | 84c406158b00fd7b88d6f9bc8d0383998b9ab6b0 /components/dfs/src/dfs.c | |
| parent | 1c419d428ed5c3ae5dc6a38583f3b8bf1f94bb87 (diff) | |
move check dfs_fd valid code from close to fd_get
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2540 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/dfs/src/dfs.c')
| -rw-r--r-- | components/dfs/src/dfs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index 86ef809fbf..fe0020b277 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -153,6 +153,13 @@ struct dfs_fd *fd_get(int fd) dfs_lock(); d = &fd_table[fd]; + /* check dfs_fd valid or not */ + if (d->path == RT_NULL || d->fs == RT_NULL) + { + dfs_unlock(); + return RT_NULL; + } + /* increase the reference count */ d->ref_count ++; dfs_unlock(); |
