extmod/modusocket: Fix errcode returned from socket read/write.

Drivers should ensure a positive errcode is returned from read/write.
This commit is contained in:
iabdalkader 2022-05-11 11:05:19 +02:00 committed by Damien George
parent 6136c7644a
commit eb957b0c95
1 changed files with 0 additions and 2 deletions

View File

@ -423,7 +423,6 @@ mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode)
mp_int_t ret = self->nic_type->recv(self, (byte *)buf, size, errcode);
if (ret < 0) {
ret = MP_STREAM_ERROR;
*errcode = -(*errcode); // expects a positive error code
}
return ret;
}
@ -436,7 +435,6 @@ mp_uint_t socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *e
mp_int_t ret = self->nic_type->send(self, buf, size, errcode);
if (ret < 0) {
ret = MP_STREAM_ERROR;
*errcode = -(*errcode); // expects a positive error code
}
return ret;
}