net: sockets: Set writefds in case of error in select()

The writefds is typically set if there is an error while
waiting for example the connect() to finish. So check if
the user supplied the writefds and update it accordingly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2023-10-18 14:21:53 +03:00 committed by Chris Friedt
parent ec4973dd15
commit 5bf18e39ad

View file

@ -196,6 +196,11 @@ int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds,
ZSOCK_FD_SET(fd, exceptfds);
num_selects++;
}
if (writefds != NULL) {
ZSOCK_FD_SET(fd, writefds);
num_selects++;
}
}
res--;