- protect against socket signal in ftp server
This commit is contained in:
parent
74824fe753
commit
34c089b9ad
|
@ -189,7 +189,12 @@ int ftpSend(socket_t s, const void *data, int len)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
currLen = send(s, data, len, 0);
|
#ifdef __APPLE__
|
||||||
|
currLen = send(s, data, len, SO_NOSIGPIPE);
|
||||||
|
#else
|
||||||
|
currLen = send(s, data, len, MSG_NOSIGNAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(currLen >= 0)
|
if(currLen >= 0)
|
||||||
{
|
{
|
||||||
len -= currLen;
|
len -= currLen;
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
#pragma comment(lib, "ws2_32")
|
#pragma comment(lib, "ws2_32")
|
||||||
#pragma comment(lib, "MSWSOCK")
|
#pragma comment(lib, "MSWSOCK")
|
||||||
|
|
||||||
|
#define MSG_NOSIGNAL 0
|
||||||
|
|
||||||
ip_t ownIp;
|
ip_t ownIp;
|
||||||
|
|
||||||
|
@ -218,8 +220,13 @@ int ftpSend(socket_t s, const void *data, int len)
|
||||||
int currLen = 0;
|
int currLen = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
currLen = send((SOCKET)s, data, len, 0);
|
#ifdef __APPLE__
|
||||||
|
currLen = send((SOCKET)s, data, len, SO_NOSIGPIPE);
|
||||||
|
#else
|
||||||
|
currLen = send((SOCKET)s, data, len, MSG_NOSIGNAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(currLen >= 0)
|
if(currLen >= 0)
|
||||||
{
|
{
|
||||||
len -= currLen;
|
len -= currLen;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user