rpmsgfs: hande count <=0 when rpmsgfs_read&write

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-05-19 12:15:24 +08:00 committed by Petro Karashchenko
parent 837c15dcb6
commit 5f60b7dc12

View File

@ -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);