mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
drivers/telnet: Let psock_poll check the valid of td_psock instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
a52fbe87eb
commit
c3b6d35290
+1
-12
@@ -1228,20 +1228,9 @@ static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct telnet_dev_s *priv = inode->i_private;
|
FAR struct telnet_dev_s *priv = inode->i_private;
|
||||||
FAR struct socket *psock;
|
|
||||||
|
|
||||||
DEBUGASSERT(fds != NULL);
|
DEBUGASSERT(fds != NULL);
|
||||||
|
|
||||||
/* Get the underlying socket structure and verify that the sockfd
|
|
||||||
* corresponds to valid, allocated socket
|
|
||||||
*/
|
|
||||||
|
|
||||||
psock = &priv->td_psock;
|
|
||||||
if (psock == NULL || psock->s_conn == NULL)
|
|
||||||
{
|
|
||||||
return -EBADF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Test if we have cached data waiting to be read */
|
/* Test if we have cached data waiting to be read */
|
||||||
|
|
||||||
if (priv->td_pending > 0)
|
if (priv->td_pending > 0)
|
||||||
@@ -1253,7 +1242,7 @@ static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
|
|
||||||
/* Then let psock_poll() do the heavy lifting */
|
/* Then let psock_poll() do the heavy lifting */
|
||||||
|
|
||||||
return psock_poll(psock, fds, setup);
|
return psock_poll(&priv->td_psock, fds, setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user