|
@@ -36,7 +36,7 @@ void* mp_flipper_file_new_file_descriptor(void* handle, const char* name, uint8_
|
|
|
static mp_uint_t mp_flipper_fileio_read(mp_obj_t self, void* buf, mp_uint_t size, int* errcode) {
|
|
static mp_uint_t mp_flipper_fileio_read(mp_obj_t self, void* buf, mp_uint_t size, int* errcode) {
|
|
|
mp_flipper_fileio_file_descriptor_t* fd = MP_OBJ_TO_PTR(self);
|
|
mp_flipper_fileio_file_descriptor_t* fd = MP_OBJ_TO_PTR(self);
|
|
|
|
|
|
|
|
- if(fd->handle != NULL) {
|
|
|
|
|
|
|
+ if(fd->handle == NULL) {
|
|
|
*errcode = MP_EIO;
|
|
*errcode = MP_EIO;
|
|
|
|
|
|
|
|
return MP_STREAM_ERROR;
|
|
return MP_STREAM_ERROR;
|
|
@@ -48,7 +48,7 @@ static mp_uint_t mp_flipper_fileio_read(mp_obj_t self, void* buf, mp_uint_t size
|
|
|
static mp_uint_t mp_flipper_fileio_write(mp_obj_t self, const void* buf, mp_uint_t size, int* errcode) {
|
|
static mp_uint_t mp_flipper_fileio_write(mp_obj_t self, const void* buf, mp_uint_t size, int* errcode) {
|
|
|
mp_flipper_fileio_file_descriptor_t* fd = MP_OBJ_TO_PTR(self);
|
|
mp_flipper_fileio_file_descriptor_t* fd = MP_OBJ_TO_PTR(self);
|
|
|
|
|
|
|
|
- if(fd->handle != NULL) {
|
|
|
|
|
|
|
+ if(fd->handle == NULL) {
|
|
|
*errcode = MP_EIO;
|
|
*errcode = MP_EIO;
|
|
|
|
|
|
|
|
return MP_STREAM_ERROR;
|
|
return MP_STREAM_ERROR;
|