On 6/10/22 12:33, Piotr Caban wrote:
-static inline int sock_error( struct fd *fd ) +static inline int sock_error( struct sock *sock, int *error ) {
- unsigned int optval = 0;
- socklen_t optlen = sizeof(optval);
- socklen_t len = sizeof(*error);
- getsockopt( get_unix_fd(fd), SOL_SOCKET, SO_ERROR, (void *) &optval, &optlen);
- return optval;
- if (getsockopt( get_unix_fd(sock->fd), SOL_SOCKET, SO_ERROR, (void *)error, &len) < 0)
return -1;
I'd personally just throw away the getsockopt() return value check instead; it should never fail.