You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/09/30 03:54:37 UTC

[incubator-nuttx] 02/03: drivers/telnet: Let psock_poll check the valid of td_psock instead

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit c3b6d35290c1f9e3b5dda033e0b32d121b6247df
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Sep 28 22:45:15 2022 +0800

    drivers/telnet: Let psock_poll check the valid of td_psock instead
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/net/telnet.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 613d33fde2..5d2f7f367e 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -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 telnet_dev_s *priv = inode->i_private;
-  FAR struct socket *psock;
 
   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 */
 
   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 */
 
-  return psock_poll(psock, fds, setup);
+  return psock_poll(&priv->td_psock, fds, setup);
 }
 
 /****************************************************************************