server_queuereader: avoid SIGPIPE warning on some platforms (like Darwin)
@@ -410,10 +410,13 @@ server_queuereader(void *d)
&self->sockbufsize, sizeof(self->sockbufsize)) != 0)
; /* ignore */
#ifdef SO_NOSIGPIPE
- if (self->ctype == CON_TCP || self->ctype == CON_UDP)
- if (setsockopt(self->fd, SOL_SOCKET, SO_NOSIGPIPE, NULL, 0) != 0)
+ if (self->ctype == CON_TCP || self->ctype == CON_UDP) {
+ int enable = 1;
+ if (setsockopt(self->fd, SOL_SOCKET, SO_NOSIGPIPE,
+ (void *)&enable, sizeof(enable)) != 0)
logout("warning: failed to ignore SIGPIPE on socket: %s\n",
strerror(errno));
+ }
#endif
}
