aboutsummaryrefslogtreecommitdiff
path: root/extmod/modlwip.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-10-16 17:24:40 +1100
committerDamien George <damien.p.george@gmail.com>2019-10-31 12:54:37 +1100
commitfeaa2516742ed4f9032a0233dcec922ac6a4e80c (patch)
treea463aa178413edef560db27a5541abd3697ee760 /extmod/modlwip.c
parentd3c383de79bd25b42339cc7a4c68b79e39eccc7c (diff)
extmod/modlwip: Make socket poll return POLLNVAL in case of bad file.
Diffstat (limited to 'extmod/modlwip.c')
-rw-r--r--extmod/modlwip.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index cd0f6946c..1e9b8c459 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -1477,6 +1477,8 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
} else if (socket->state == ERR_RST) {
// Socket was reset by peer, a write will return an error
ret |= flags & (MP_STREAM_POLL_WR | MP_STREAM_POLL_HUP);
+ } else if (socket->state == _ERR_BADF) {
+ ret |= MP_STREAM_POLL_NVAL;
} else if (socket->state < 0) {
// Socket in some other error state, use catch-all ERR flag
// TODO: may need to set other return flags here