aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-11-25 15:43:21 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-11-27 22:47:12 +0100
commita900d45489fc14d701840995db3ee6c8751a92ec (patch)
tree827f32b34672272b8403f1a5b4074aaff1586412 /lib
parente64f91feb7075fe30a179fba71f75409f962b685 (diff)
curl_multi_cleanup: ignore SIGPIPE
This is an extension to the fix in 7d80ed64e43515. We may call Curl_disconnect() while cleaning up the multi handle, which could lead to openssl sending packets, which could get a SIGPIPE. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/multi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 923e2ced8..df8befa48 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -41,6 +41,7 @@
#include "bundles.h"
#include "multihandle.h"
#include "pipeline.h"
+#include "sigpipe.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -1786,12 +1787,18 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
struct SessionHandle *nextdata;
if(GOOD_MULTI_HANDLE(multi)) {
+ SIGPIPE_VARIABLE(pipe);
+ bool restore_pipe = FALSE;
+
multi->type = 0; /* not good anymore */
/* Close all the connections in the connection cache */
close_all_connections(multi);
if(multi->closure_handle) {
+ sigpipe_ignore(multi->closure_handle, &pipe);
+ restore_pipe = TRUE;
+
multi->closure_handle->dns.hostcache = multi->hostcache;
Curl_hostcache_clean(multi->closure_handle,
multi->closure_handle->dns.hostcache);
@@ -1836,6 +1843,8 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
Curl_pipeline_set_server_blacklist(NULL, &multi->pipelining_server_bl);
free(multi);
+ if(restore_pipe)
+ sigpipe_restore(&pipe);
return CURLM_OK;
}