Skip to content

Commit

Permalink
Add support for getsockopt with SO_ERROR.
Browse files Browse the repository at this point in the history
This is cherry picked from #339, since it is not related.
  • Loading branch information
tuexen committed Aug 7, 2019
1 parent 1c34f3d commit 42fd827
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions usrsctplib/user_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2406,6 +2406,20 @@ usrsctp_getsockopt(struct socket *so, int level, int option_name,
*option_len = (socklen_t)sizeof(struct linger);
return (0);
}
break;
case SO_ERROR:
if (*option_len < (socklen_t)sizeof(int)) {
errno = EINVAL;
return (-1);
} else {
int *intval;

intval = (int *)option_value;
*intval = so->so_error;
*option_len = (socklen_t)sizeof(int);
return (0);
}
break;
default:
errno = EINVAL;
return (-1);
Expand Down

0 comments on commit 42fd827

Please sign in to comment.