psock_socket: Add type field check
behavior alignment to Linux Return EINVAL when type field include nonsupport bit Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
2be529121a
commit
dc577b66e4
@ -82,6 +82,11 @@ int psock_socket(int domain, int type, int protocol,
|
|||||||
FAR const struct sock_intf_s *sockif = NULL;
|
FAR const struct sock_intf_s *sockif = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK | SOCK_TYPE_MASK))
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the socket structure */
|
/* Initialize the socket structure */
|
||||||
|
|
||||||
psock->s_domain = domain;
|
psock->s_domain = domain;
|
||||||
|
Loading…
Reference in New Issue
Block a user