diff options
| author | zhuzhuzhu <[email protected]> | 2024-06-13 08:54:02 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-13 08:54:02 +0800 |
| commit | 1869c543a60b7d05df4dd69d9eb08f6df6ae3d2e (patch) | |
| tree | 297bc5dc45e95ebb13f71fc0e82b9e24dd607155 /components | |
| parent | 58e42caea7f8b5145841327cff02fb4f3ebfeeb0 (diff) | |
[fix]fix tmpfs bug (#8970)
* first
* second
* thrid
* Update SConscript
* tmpfs testcase default n
* Update dfs_tmpfs.c
* format document
---------
Co-authored-by: zhujiale <[email protected]>
Diffstat (limited to 'components')
| -rw-r--r-- | components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c b/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c index 8644f51c26..1c2a509475 100644 --- a/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c +++ b/components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c @@ -294,18 +294,17 @@ find_subpath: static ssize_t dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos) { - rt_size_t length; + ssize_t length; struct tmpfs_file *d_file; - d_file = (struct tmpfs_file *)file->vnode->data; RT_ASSERT(d_file != NULL); rt_mutex_take(&file->vnode->lock, RT_WAITING_FOREVER); - - if (count < file->vnode->size - *pos) + ssize_t size = (ssize_t)file->vnode->size; + if ((ssize_t)count < size - *pos) length = count; else - length = file->vnode->size - *pos; + length = size - *pos; if (length > 0) memcpy(buf, &(d_file->data[*pos]), length); |
