mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-22 23:37:43 +08:00
fix(fsdrv): return error in case of the read/write failure (#2729)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -151,7 +151,7 @@ static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_
|
||||
{
|
||||
LV_UNUSED(drv);
|
||||
*br = read((lv_uintptr_t)file_p, buf, btr);
|
||||
return LV_FS_RES_OK;
|
||||
return (int32_t)*br < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
|
||||
{
|
||||
LV_UNUSED(drv);
|
||||
*bw = write((lv_uintptr_t)file_p, buf, btw);
|
||||
return LV_FS_RES_OK;
|
||||
return (int32_t)*bw ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -152,7 +152,7 @@ static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_
|
||||
{
|
||||
LV_UNUSED(drv);
|
||||
*br = fread(buf, 1, btr, file_p);
|
||||
return LV_FS_RES_OK;
|
||||
return (int32_t)*br < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
|
||||
{
|
||||
LV_UNUSED(drv);
|
||||
*bw = fwrite(buf, 1, btw, file_p);
|
||||
return LV_FS_RES_OK;
|
||||
return (int32_t)*bw ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user