Browse Source

Merge commit 'c4a8f47' into cg_merges_20130524b
Bugfix: Correctly avoid SIGPIPE on Mac

Luke Dashjr 12 years ago
parent
commit
77558d005e
1 changed files with 5 additions and 3 deletions
  1. 5 3
      util.c

+ 5 - 3
util.c

@@ -1198,10 +1198,12 @@ static enum send_ret __stratum_send(struct pool *pool, char *s, ssize_t len)
 		FD_SET(sock, &wd);
 		if (select(sock + 1, NULL, &wd, NULL, &timeout) < 1)
 			return SEND_SELECTFAIL;
-#ifndef WIN32
-		sent = send(pool->sock, s + ssent, len, MSG_NOSIGNAL);
-#else
+#ifdef __APPLE__
+		sent = send(pool->sock, s + ssent, len, SO_NOSIGPIPE);
+#elif WIN32
 		sent = send(pool->sock, s + ssent, len, 0);
+#else
+		sent = send(pool->sock, s + ssent, len, MSG_NOSIGNAL);
 #endif
 		if (sent < 0) {
 			if (!sock_blocks())