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

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

commit 745ce8ee510c4c1d317daa4a2c1f62b3d2384221
Author: cuiziwei <[email protected]>
AuthorDate: Tue May 12 22:26:59 2026 +0800

    rexec: fix exit code on POLLHUP from remote socket
    
    When the remote command completes and the socket is closed, poll()
    reports POLLHUP. The code breaks out of the relay loop, but 'ret'
    still holds the return value of the previous write() call (a positive
    byte count), causing rexec to exit with a non-zero status even though
    the remote command succeeded.
    
    Set ret = 0 before breaking on POLLHUP so that rexec correctly
    reports success when the remote side closes the connection normally.
    
    Signed-off-by: cuiziwei <[email protected]>
    Assisted-by: Kiro:claude-opus-4
---
 netutils/rexec/rexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/netutils/rexec/rexec.c b/netutils/rexec/rexec.c
index 590dd9824..cfc94da0c 100644
--- a/netutils/rexec/rexec.c
+++ b/netutils/rexec/rexec.c
@@ -134,6 +134,7 @@ static int do_rexec(FAR struct rexec_arg_s *arg)
 
       if (fds[0].revents & POLLHUP)
         {
+          ret = 0;
           break;
         }
 

Reply via email to