Skip to content

Commit 0779409

Browse files
committed
extmod/modlwip: lwip_tcp_receive: Properly map lwIP error to POSIX errno.
1 parent ba8f7d5 commit 0779409

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

extmod/modlwip.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ STATIC mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
396396
return 0;
397397
}
398398
} else if (socket->state != STATE_CONNECTED) {
399-
*_errno = -socket->state;
399+
assert(socket->state < 0);
400+
*_errno = error_lookup_table[-socket->state];
400401
return -1;
401402
}
402403
}

0 commit comments

Comments
 (0)