net/socket/bind: make sure that an address was provided
1. make sure that an address was provided on bind() call 2. correct the return value if bad socket handler Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
b005f844f5
commit
6340154f97
@ -82,7 +82,14 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
|
||||
|
||||
if (!psock || psock->s_conn == NULL)
|
||||
{
|
||||
return -ENOTSOCK;
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
/* Make sure that an address was provided */
|
||||
|
||||
if (addr == NULL)
|
||||
{
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Let the address family's connect() method handle the operation */
|
||||
|
Loading…
x
Reference in New Issue
Block a user