You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/03 13:17:33 UTC

[incubator-nuttx-apps] 03/06: Skip to close acceptsd since it is already closed in SIOCTELNET handler

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

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

commit d6e450e39a228776f52da3a3653760561071fa56
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Feb 3 17:11:41 2020 +0800

    Skip to close acceptsd since it is already closed in SIOCTELNET handler
    
    Change-Id: I669224fd5cd44162bb67c8316b56348f7f298883
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 netutils/telnetd/telnetd_daemon.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/netutils/telnetd/telnetd_daemon.c b/netutils/telnetd/telnetd_daemon.c
index 6357993..8dd5675 100644
--- a/netutils/telnetd/telnetd_daemon.c
+++ b/netutils/telnetd/telnetd_daemon.c
@@ -83,7 +83,7 @@ struct telnetd_s
 };
 
 /****************************************************************************
- * Public Functions
+ * Private Functions
  ****************************************************************************/
 
 /****************************************************************************
@@ -250,19 +250,15 @@ static int telnetd_daemon(int argc, FAR char *argv[])
       acceptsd = accept(listensd, &addr.generic, &accptlen);
       if (acceptsd < 0)
         {
-          /* Accept failed */
-
-          int errval = errno;
-
           /* Just continue if a signal was received */
 
-          if (errval == EINTR)
+          if (errno == EINTR)
             {
               continue;
             }
           else
             {
-              nerr("ERROR: accept failed: %d\n", errval);
+              nerr("ERROR: accept failed: %d\n", errno);
               goto errout_with_socket;
             }
         }
@@ -311,7 +307,7 @@ static int telnetd_daemon(int argc, FAR char *argv[])
       if (drvrfd < 0)
         {
           nerr("ERROR: Failed to open %s: %d\n", session.ts_devpath, errno);
-          goto errout_with_acceptsd;
+          goto errout_with_socket;
         }
 
       /* Use this driver as stdin, stdout, and stderror */
@@ -337,7 +333,7 @@ static int telnetd_daemon(int argc, FAR char *argv[])
       if (pid < 0)
         {
           nerr("ERROR: Failed start the telnet session: %d\n", errno);
-          goto errout_with_acceptsd;
+          goto errout_with_socket;
         }
 
       /* Forget about the connection. */