Skip to content

Commit

Permalink
Backward compatibility MSG_NOSIGNAL
Browse files Browse the repository at this point in the history
  • Loading branch information
denji committed Jul 21, 2015
1 parent 7a1d12a commit d37065f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nailgun-client/ng.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@
typedef unsigned int SOCKET;
#endif

#ifdef __APPLE__
#define SEND_FLAGS 0
#else
#define SEND_FLAGS MSG_NOSIGNAL
// MSG_NOSIGNAL does not exists on OS X
#if defined(__APPLE__) || defined(__MACH__)
# ifndef MSG_NOSIGNAL
# define MSG_NOSIGNAL SO_NOSIGPIPE
# endif
#endif

#ifndef MIN
Expand Down Expand Up @@ -200,7 +201,7 @@ int sendAll(SOCKET s, char *buf, int len) {
int n = 0;

while(total < len) {
n = send(s, buf+total, bytesleft, SEND_FLAGS);
n = send(s, buf+total, bytesleft, MSG_NOSIGNAL);

if (n == -1) {
break;
Expand Down

0 comments on commit d37065f

Please sign in to comment.