mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
If HAVE_MSG_NOSIGNAL is set, we use MSG_NOSIGNAL when we call send() and
recv() and we no longer attempt to ignore the SIGPIPE signal.
This commit is contained in:
parent
909887f310
commit
2cf209d3f7
25
lib/setup.h
25
lib/setup.h
@ -116,6 +116,15 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MSG_NOSIGNAL
|
||||
/* If we have the MSG_NOSIGNAL define, we make sure to use that in the forth
|
||||
argument to send() and recv() */
|
||||
#define SEND_4TH_ARG MSG_NOSIGNAL
|
||||
#else
|
||||
#define SEND_4TH_ARG 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Below we define four functions. They should
|
||||
1. close a socket
|
||||
2. read from a socket
|
||||
@ -139,14 +148,14 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
|
||||
#if !defined(__GNUC__) || defined(__MINGW32__)
|
||||
#define sclose(x) closesocket(x)
|
||||
#define sread(x,y,z) recv(x,y,z,0)
|
||||
#define swrite(x,y,z) (size_t)send(x,y,z,0)
|
||||
#define sread(x,y,z) recv(x,y,z, SEND_4TH_ARG)
|
||||
#define swrite(x,y,z) (size_t)send(x,y,z, SEND_4TH_ARG)
|
||||
#undef HAVE_ALARM
|
||||
#else
|
||||
/* gcc-for-win is still good :) */
|
||||
#define sclose(x) close(x)
|
||||
#define sread(x,y,z) recv(x,y,z,0)
|
||||
#define swrite(x,y,z) send(x,y,z,0)
|
||||
#define sread(x,y,z) recv(x,y,z, SEND_4TH_ARG)
|
||||
#define swrite(x,y,z) send(x,y,z, SEND_4TH_ARG)
|
||||
#define HAVE_ALARM
|
||||
#endif
|
||||
|
||||
@ -171,12 +180,12 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
|
||||
|
||||
#ifdef __BEOS__
|
||||
#define sclose(x) closesocket(x)
|
||||
#define sread(x,y,z) (ssize_t)recv(x,y,z,0)
|
||||
#define swrite(x,y,z) (ssize_t)send(x,y,z,0)
|
||||
#define sread(x,y,z) (ssize_t)recv(x,y,z, SEND_4TH_ARG)
|
||||
#define swrite(x,y,z) (ssize_t)send(x,y,z, SEND_4TH_ARG)
|
||||
#else
|
||||
#define sclose(x) close(x)
|
||||
#define sread(x,y,z) recv(x,y,z,0)
|
||||
#define swrite(x,y,z) send(x,y,z,0)
|
||||
#define sread(x,y,z) recv(x,y,z, SEND_4TH_ARG)
|
||||
#define swrite(x,y,z) send(x,y,z, SEND_4TH_ARG)
|
||||
#endif
|
||||
|
||||
#define HAVE_ALARM
|
||||
|
@ -1457,7 +1457,7 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
|
||||
* different ports! */
|
||||
data->state.allow_port = TRUE;
|
||||
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)
|
||||
/*************************************************************
|
||||
* Tell signal handler to ignore SIGPIPE
|
||||
*************************************************************/
|
||||
@ -1473,7 +1473,7 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
|
||||
|
||||
CURLcode Curl_posttransfer(struct SessionHandle *data)
|
||||
{
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)
|
||||
/* restore the signal handler for SIGPIPE before we get back */
|
||||
if(!data->set.no_signal)
|
||||
signal(SIGPIPE, data->state.prev_signal);
|
||||
|
Loading…
Reference in New Issue
Block a user