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

    netutils/xmlrpc: Do not raise SIGPIPE when a client closes.
    
    xmlrpc_parse() writes the response to the client socket with write().
    When the client closed the connection, the write fails with EPIPE.  A
    write to a stream socket whose peer is gone also raises SIGPIPE, and
    with CONFIG_SIG_SIGPIPE_ACTION the default action ends the server that
    calls xmlrpc_parse().
    
    Send the response with MSG_NOSIGNAL.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 netutils/xmlrpc/xmlparser.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/netutils/xmlrpc/xmlparser.c b/netutils/xmlrpc/xmlparser.c
index ca4d6de68..34984069b 100644
--- a/netutils/xmlrpc/xmlparser.c
+++ b/netutils/xmlrpc/xmlparser.c
@@ -52,6 +52,7 @@
  * Included Files
  ****************************************************************************/
 
+#include <sys/socket.h>
 #include <ctype.h>
 #include <string.h>
 #include <stdio.h>
@@ -412,7 +413,8 @@ int xmlrpc_parse(int sock, char *buffer)
 
   if (ret == 0)
     {
-      write(sock, g_xmlcall.response, strlen(g_xmlcall.response));
+      send(sock, g_xmlcall.response, strlen(g_xmlcall.response),
+           MSG_NOSIGNAL);
     }
   else
     {
@@ -420,7 +422,8 @@ int xmlrpc_parse(int sock, char *buffer)
 
       g_xmlcall.error = 1;
       xmlrpc_sendfault(ret);
-      write(sock, g_xmlcall.response, strlen(g_xmlcall.response));
+      send(sock, g_xmlcall.response, strlen(g_xmlcall.response),
+           MSG_NOSIGNAL);
     }
 
   return ret;

Reply via email to