mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-01 00:51:49 +08:00
feat(fsdrv): add posix lseek() error checking (#3444)
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
@@ -176,8 +176,8 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
|
|||||||
static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence)
|
static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence)
|
||||||
{
|
{
|
||||||
LV_UNUSED(drv);
|
LV_UNUSED(drv);
|
||||||
lseek((lv_uintptr_t)file_p, pos, whence);
|
off_t offset = lseek((lv_uintptr_t)file_p, pos, whence);
|
||||||
return LV_FS_RES_OK;
|
return offset < 0 ? LV_FS_RES_FS_ERR : LV_FS_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,8 +191,9 @@ static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs
|
|||||||
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
||||||
{
|
{
|
||||||
LV_UNUSED(drv);
|
LV_UNUSED(drv);
|
||||||
*pos_p = lseek((lv_uintptr_t)file_p, 0, SEEK_CUR);
|
off_t offset = lseek((lv_uintptr_t)file_p, 0, SEEK_CUR);
|
||||||
return LV_FS_RES_OK;
|
*pos_p = offset;
|
||||||
|
return offset < 0 ? LV_FS_RES_FS_ERR : LV_FS_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
Reference in New Issue
Block a user