testbot/testagentd: Catch SIGPIPE so the server does not die if the client disconnects during a file transfer.
Francois Gouget
fgouget at codeweavers.com
Mon Feb 25 09:59:57 CST 2013
---
testbot/src/testagentd/platform_unix.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/testbot/src/testagentd/platform_unix.c b/testbot/src/testagentd/platform_unix.c
index 797a3d2..6552e05 100644
--- a/testbot/src/testagentd/platform_unix.c
+++ b/testbot/src/testagentd/platform_unix.c
@@ -247,6 +247,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;
@@ -255,5 +257,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;
}
--
1.7.10.4
More information about the wine-patches
mailing list