Francois Gouget : testbot/testagentd: Catch SIGPIPE so the server does not die if the client disconnects during a file transfer .

Alexandre Julliard julliard at winehq.org
Mon Feb 25 14:02:21 CST 2013


Module: tools
Branch: master
Commit: da4926a61e72a4a91e1941a53872828a9d725ea7
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=da4926a61e72a4a91e1941a53872828a9d725ea7

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Feb 25 16:59:57 2013 +0100

testbot/testagentd: Catch SIGPIPE so the server does not die if the client disconnects during a file transfer.

---

 testbot/src/testagentd/platform_unix.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/testbot/src/testagentd/platform_unix.c b/testbot/src/testagentd/platform_unix.c
index d7d8f54..cd08c58 100644
--- a/testbot/src/testagentd/platform_unix.c
+++ b/testbot/src/testagentd/platform_unix.c
@@ -228,6 +228,8 @@ void ta_freeaddrinfo(struct addrinfo *addresses)
 int platform_init(void)
 {
     struct sigaction sa, osa;
+
+    /* Catch SIGCHLD so we can keep track of child processes */
     sa.sa_handler = reaper;
     sigemptyset(&sa.sa_mask);
     sa.sa_flags = SA_RESTART;
@@ -236,5 +238,18 @@ int platform_init(void)
         error("could not set up the SIGCHLD handler: %s\n", strerror(errno));
         return 0;
     }
+
+    /* Catch SIGPIPE so we don't die if the client disconnects at an
+     * inconvenient time
+     */
+    sa.sa_handler = SIG_IGN;
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = SA_RESTART;
+    if (sigaction(SIGPIPE, &sa, &osa) < 0)
+    {
+        error("could not set up the SIGPIPE handler: %s\n", strerror(errno));
+        return 0;
+    }
+
     return 1;
 }




More information about the wine-cvs mailing list