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

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

commit 26405e01a9b463e14f84c9353b968968f7e868d6
Author: Marco Casaroli <[email protected]>
AuthorDate: Sat Nov 21 17:10:57 2026 +0100

    testing/nettest: Wait in select() of the loopback server with no timeout.
    
    nettest_lo_listener() gives select() a timeout with tv_sec = -1 to wait
    with no end.  Since nuttx 03db4966d8c ("fs/vfs: validate nfds bounds and
    timeout in select and poll"), select() returns EINVAL for a negative
    timeout, as POSIX requires.  The server thread then ends at once, and
    test_tcp_connect_ipv4 and test_tcp_connect_ipv6 fail: connect() gets
    ECONNREFUSED.
    
    Give select() a NULL timeout.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 testing/nettest/utils/nettest_tcpserver.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/testing/nettest/utils/nettest_tcpserver.c 
b/testing/nettest/utils/nettest_tcpserver.c
index 5ff238fd6..c9f56668f 100644
--- a/testing/nettest/utils/nettest_tcpserver.c
+++ b/testing/nettest/utils/nettest_tcpserver.c
@@ -299,7 +299,6 @@ FAR static void *nettest_lo_listener(pthread_addr_t pvarg)
 {
   FAR sem_t *sem = (FAR sem_t *)pvarg;
   struct nettest_listener_s nls;
-  struct timeval timeout;
   bool exiting = false;
   int nsds;
   int ret;
@@ -319,11 +318,6 @@ FAR static void *nettest_lo_listener(pthread_addr_t pvarg)
 
   nls.mxsd = MAX(nls.listensdv4, nls.listensdv6);
 
-  /* Set up indefinitely timeout */
-
-  timeout.tv_sec  = -1;
-  timeout.tv_usec = 0;
-
   /* Loop waiting for incoming connections or for incoming data
    * on any of the connect sockets.
    */
@@ -332,10 +326,10 @@ FAR static void *nettest_lo_listener(pthread_addr_t pvarg)
 
   while (!exiting)
     {
-      /* Wait on select */
+      /* Wait on select, with no timeout */
 
       memcpy(&nls.working, &nls.master, sizeof(fd_set));
-      ret = select(nls.mxsd + 1, &nls.working, NULL, NULL, &timeout);
+      ret = select(nls.mxsd + 1, &nls.working, NULL, NULL, NULL);
       if (ret < 0)
         {
           break;

Reply via email to