diff options
| author | [email protected] <[email protected]> | 2011-03-06 15:01:13 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2011-03-06 15:01:13 +0000 |
| commit | a0cce584a880cde49a8542829eca7aee595d76cb (patch) | |
| tree | 1277c790dacbffeecc9ef3159c1dae744c23a2c3 | |
| parent | 62c1662366eeb7f7f0b5c3bc8d2d9549bca40ca2 (diff) | |
fix open directory but without O_DIRECTORY flag issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1313 bbd45198-f89e-11dd-88c7-29a3b14d5316
| -rw-r--r-- | components/dfs/filesystems/romfs/dfs_romfs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/components/dfs/filesystems/romfs/dfs_romfs.c b/components/dfs/filesystems/romfs/dfs_romfs.c index 123299ee51..f78d905a34 100644 --- a/components/dfs/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/filesystems/romfs/dfs_romfs.c @@ -146,6 +146,10 @@ int dfs_romfs_open(struct dfs_fd* file) dirent = dfs_romfs_lookup(root_dirent, file->path, &size);
if (dirent == RT_NULL) return -DFS_STATUS_ENOENT;
+ /* is a directory but not with O_DIRECTORY flag */
+ if ((dirent->type == ROMFS_DIRENT_DIR) && !(file->flags & DFS_O_DIRECTORY))
+ return -DFS_STATUS_ENOENT;
+
file->data = dirent;
file->size = size;
file->pos = 0;
|
