Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/socket/getsockopt: move the options check to the upper layer #15899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions net/socket/getsockopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
{
FAR struct socket_conn_s *conn = psock->s_conn;

/* Verify that the socket option if valid (but might not be supported ) */

if (!value || !value_len)
{
return -EINVAL;
}

/* Process the options always handled locally */

switch (option)
Expand Down Expand Up @@ -271,6 +264,13 @@ int psock_getsockopt(FAR struct socket *psock, int level, int option,
{
int ret = -ENOPROTOOPT;

/* Verify that the socket option is valid (but might not be supported ) */

if (value == NULL || value_len == NULL || *value_len == 0)
{
return -EINVAL;
}

/* Verify that the sockfd corresponds to valid, allocated socket */

if (psock == NULL || psock->s_conn == NULL)
Expand Down
Loading