mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
rpmsgfs: hande count <=0 when rpmsgfs_read&write
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -451,6 +451,11 @@ ssize_t rpmsgfs_client_read(FAR void *handle, int fd,
|
||||
struct rpmsgfs_read_s msg;
|
||||
int ret = 0;
|
||||
|
||||
if (!buf || count <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&cookie, 0, sizeof(cookie));
|
||||
|
||||
nxsem_init(&cookie.sem, 0, 0);
|
||||
@@ -490,6 +495,11 @@ ssize_t rpmsgfs_client_write(FAR void *handle, int fd,
|
||||
size_t written = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (!buf || count <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&cookie, 0, sizeof(cookie));
|
||||
nxsem_init(&cookie.sem, 0, 0);
|
||||
nxsem_set_protocol(&cookie.sem, SEM_PRIO_NONE);
|
||||
|
||||
Reference in New Issue
Block a user