From 1869c543a60b7d05df4dd69d9eb08f6df6ae3d2e Mon Sep 17 00:00:00 2001 From: zhuzhuzhu <945386260@qq.com> Date: Thu, 13 Jun 2024 08:54:02 +0800 Subject: [fix]fix tmpfs bug (#8970) * first * second * thrid * Update SConscript * tmpfs testcase default n * Update dfs_tmpfs.c * format document --------- Co-authored-by: zhujiale --- components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'components') 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); -- cgit v1.3.1