net/inet: Only setup poll for UDP when s_type == SOCK_DGRAM

Problem:
A SOCK_CTRL socket may be led to udp_pollsetup but never reaches
udp_pollteardown, it seems that we shouldn't call udp_pollsetup for
other socket types.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng
2023-03-24 16:41:38 +08:00
committed by Alan Carvalho de Assis
parent 0550082966
commit 61ff04b9e2
+1 -1
View File
@@ -1503,7 +1503,7 @@ static inline int inet_pollsetup(FAR struct socket *psock,
else
#endif /* NET_TCP_HAVE_STACK */
#ifdef NET_UDP_HAVE_STACK
if (psock->s_type != SOCK_STREAM)
if (psock->s_type == SOCK_DGRAM)
{
return udp_pollsetup(psock, fds);
}