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 e3e4bb54b4768fa4c8f185fa903f3e6aae11536f
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Nov 2 11:13:43 2026 +0100

    netutils/ftpd: Do not die of SIGPIPE when a client closes.
    
    ftpd_send() sends the replies and the file data with send().  When the
    client closed the connection, a send to it fails with EPIPE.  A send
    to a stream socket whose peer is gone also raises SIGPIPE, and with
    CONFIG_SIG_SIGPIPE_ACTION the default action ends the FTP daemon: the
    server stops for all clients.
    
    Send with MSG_NOSIGNAL.  The error ends only the session or the
    transfer, as before.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 netutils/ftpd/ftpd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netutils/ftpd/ftpd.c b/netutils/ftpd/ftpd.c
index 712c679c6..d9a24eeb8 100644
--- a/netutils/ftpd/ftpd.c
+++ b/netutils/ftpd/ftpd.c
@@ -1014,7 +1014,7 @@ static ssize_t ftpd_send(int sd, FAR const void *data, 
size_t size,
 
   /* Then send the data (waiting if necessary) */
 
-  ret = send(sd, data, size, 0);
+  ret = send(sd, data, size, MSG_NOSIGNAL);
   if (ret < 0)
     {
       int errval = errno;

Reply via email to