summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>2016-05-18 16:02:19 -0400
committerHolger Freyther <holger@freyther.de>2016-05-20 16:32:58 +0000
commitcc3694b650e22598811b3e5eaf74ef3dc0e4f7ab (patch)
treece55265c78ea37b79afdf9628d5c109425109a66 /src
parent78ad042f94afd5bf7de477ae634e9d2fdd9c9dc4 (diff)
Fix build for OSX
Change-Id: I580a500edcf4812e570be586890abef746083a8c Reviewed-on: https://gerrit.osmocom.org/74 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
Diffstat (limited to 'src')
-rw-r--r--src/stats.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/stats.c b/src/stats.c
index 73b27033..5f1d028b 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -301,6 +301,14 @@ int osmo_stats_reporter_udp_open(struct osmo_stats_reporter *srep)
if (sock == -1)
return -errno;
+#if defined(__APPLE__) && !defined(MSG_NOSIGNAL)
+ {
+ static int val = 1;
+
+ rc = setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void*)&val, sizeof(val));
+ goto failed;
+ }
+#endif
if (srep->bind_addr_len > 0) {
rc = bind(sock, &srep->bind_addr, srep->bind_addr_len);
if (rc == -1)
@@ -345,7 +353,11 @@ int osmo_stats_reporter_send(struct osmo_stats_reporter *srep, const char *data,
{
int rc;
- rc = sendto(srep->fd, data, data_len, MSG_NOSIGNAL | MSG_DONTWAIT,
+ rc = sendto(srep->fd, data, data_len,
+#ifdef MSG_NOSIGNAL
+ MSG_NOSIGNAL |
+#endif
+ MSG_DONTWAIT,
&srep->dest_addr, srep->dest_addr_len);
if (rc == -1)