- protect against socket signal in ftp server

This commit is contained in:
Mark Vejvoda 2011-01-09 08:01:14 +00:00
parent 74824fe753
commit 34c089b9ad
2 changed files with 15 additions and 3 deletions

View File

@ -189,7 +189,12 @@ int ftpSend(socket_t s, const void *data, int len)
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)
{
len -= currLen;

View File

@ -31,6 +31,8 @@
#pragma comment(lib, "ws2_32")
#pragma comment(lib, "MSWSOCK")
#define MSG_NOSIGNAL 0
ip_t ownIp;
@ -218,8 +220,13 @@ int ftpSend(socket_t s, const void *data, int len)
int currLen = 0;
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)
{
len -= currLen;