mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-11 21:56:07 +00:00
core/modtrezorio: raise error when no space left on FAT FS
This commit is contained in:
parent
743f57afdb
commit
972a96f1a0
@ -184,6 +184,10 @@ STATIC mp_obj_t mod_trezorio_FatFSFile_write(mp_obj_t self, mp_obj_t data) {
|
||||
if (res != FR_OK) {
|
||||
mp_raise_OSError(fresult_to_errno_table[res]);
|
||||
}
|
||||
if (written != buf.len) {
|
||||
/* no space left on device or free clusters recorded in FSInfo fell to 0 */
|
||||
mp_raise_OSError(MP_ENOSPC);
|
||||
}
|
||||
return mp_obj_new_int_from_uint(written);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorio_FatFSFile_write_obj, mod_trezorio_FatFSFile_write);
|
||||
|
Loading…
Reference in New Issue
Block a user