diff options
author | hrs <hrs@FreeBSD.org> | 2016-06-14 15:39:24 +0800 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2016-06-14 15:39:24 +0800 |
commit | 31779944506f3a7e60cc091a98acdffa6554a0a8 (patch) | |
tree | 5f72df174e1bf9f8f9ecf04d3657f1ae48176573 /net | |
parent | 20c8ff080bef719ba7eb9b7edca4e6a56b23da64 (diff) | |
download | freebsd-ports-gnome-31779944506f3a7e60cc091a98acdffa6554a0a8.tar.gz freebsd-ports-gnome-31779944506f3a7e60cc091a98acdffa6554a0a8.tar.zst freebsd-ports-gnome-31779944506f3a7e60cc091a98acdffa6554a0a8.zip |
Fix build on 9.x.
Diffstat (limited to 'net')
-rw-r--r-- | net/smcroute/files/patch-ipc.c | 52 | ||||
-rw-r--r-- | net/smcroute/files/patch-mcgroup.c | 50 | ||||
-rw-r--r-- | net/smcroute/files/patch-mroute-api.c | 55 |
3 files changed, 157 insertions, 0 deletions
diff --git a/net/smcroute/files/patch-ipc.c b/net/smcroute/files/patch-ipc.c new file mode 100644 index 000000000000..40ea56b8bca8 --- /dev/null +++ b/net/smcroute/files/patch-ipc.c @@ -0,0 +1,52 @@ +--- ipc.c.orig 2016-02-17 21:02:06 UTC ++++ ipc.c +@@ -50,9 +50,22 @@ int ipc_server_init(void) + if (server_sd >= 0) + close(server_sd); + ++#ifdef SOCK_CLOEXEC + server_sd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); ++#else ++ server_sd = socket(AF_UNIX, SOCK_STREAM, 0); ++#endif + if (server_sd < 0) + return -1; ++#ifndef SOCK_CLOEXEC ++ if (fcntl(server_sd, F_SETFD, FD_CLOEXEC) < 0) { ++ int err = errno; ++ close(server_sd); ++ server_sd = -1; ++ errno = err; ++ return server_sd; ++ } ++#endif + + #ifdef HAVE_SOCKADDR_UN_SUN_LEN + sa.sun_len = 0; /* <- correct length is set by the OS */ +@@ -89,10 +102,26 @@ int ipc_client_init(void) + if (client_sd >= 0) + close(client_sd); + ++#ifdef SOCK_CLOEXEC + client_sd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); ++#else ++ client_sd = socket(AF_UNIX, SOCK_STREAM, 0); ++#endif + if (client_sd < 0) + return -1; + ++#ifndef SOCK_CLOEXEC ++ if (fcntl(client_sd, F_SETFD, FD_CLOEXEC) < 0) { ++ int err = errno; ++ ++ close(client_sd); ++ client_sd = -1; ++ ++ errno = err; ++ return -1; ++ } ++#endif ++ + #ifdef HAVE_SOCKADDR_UN_SUN_LEN + sa.sun_len = 0; /* <- correct length is set by the OS */ + #endif diff --git a/net/smcroute/files/patch-mcgroup.c b/net/smcroute/files/patch-mcgroup.c new file mode 100644 index 000000000000..d2cc2cdfddbf --- /dev/null +++ b/net/smcroute/files/patch-mcgroup.c @@ -0,0 +1,50 @@ +--- mcgroup.c.orig 2016-02-17 21:02:06 UTC ++++ mcgroup.c +@@ -54,11 +54,23 @@ static struct iface *find_valid_iface(co + static void mcgroup4_init(void) + { + if (mcgroup4_socket < 0) { ++#ifdef SOCK_CLOEXEC + mcgroup4_socket = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); ++#else ++ mcgroup4_socket = socket(AF_INET, SOCK_DGRAM, 0); ++#endif + if (mcgroup4_socket < 0) { + smclog(LOG_ERR, "Failed creating socket for joining IPv4 multicast groups: %m"); + exit(255); + } ++#ifndef SOCK_CLOEXEC ++ if (fcntl(mcgroup4_socket, F_SETFD, FD_CLOEXEC) < 0) { ++ smclog(LOG_WARNING, "Failed creating socket for joining IPv4 multicast groups: %m"); ++ close(mcgroup4_socket); ++ mcgroup4_socket = -1; ++ return; ++ } ++#endif + + #ifdef __linux__ + if (setsockopt(mcgroup4_socket, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof(fprog)) < 0) +@@ -132,11 +144,23 @@ static int mcgroup6_socket = -1; + static void mcgroup6_init(void) + { + if (mcgroup6_socket < 0) { ++#ifdef SOCK_CLOEXEC + mcgroup6_socket = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP); ++#else ++ mcgroup6_socket = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); ++#endif + if (mcgroup6_socket < 0) { + smclog(LOG_WARNING, "Failed creating socket for joining IPv6 multicast groups: %m"); + return; + } ++#ifndef SOCK_CLOEXEC ++ if (fcntl(mcgroup6_socket, F_SETFD, FD_CLOEXEC) < 0) { ++ smclog(LOG_WARNING, "Failed creating socket for joining IPv6 multicast groups: %m"); ++ close(mcgroup6_socket); ++ mcgroup6_socket = -1; ++ return; ++ } ++#endif + + #ifdef __linux__ + if (setsockopt(mcgroup6_socket, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof(fprog)) < 0) diff --git a/net/smcroute/files/patch-mroute-api.c b/net/smcroute/files/patch-mroute-api.c new file mode 100644 index 000000000000..8158d37c136a --- /dev/null +++ b/net/smcroute/files/patch-mroute-api.c @@ -0,0 +1,55 @@ +--- mroute-api.c.orig 2016-02-17 21:02:06 UTC ++++ mroute-api.c +@@ -98,13 +98,26 @@ int mroute4_enable(void) + unsigned int i; + struct iface *iface; + ++#ifdef SOCK_CLOEXEC + mroute4_socket = socket(AF_INET, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_IGMP); ++#else ++ mroute4_socket = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP); ++#endif + if (mroute4_socket < 0) { + if (ENOPROTOOPT == errno) + smclog(LOG_WARNING, "Kernel does not support IPv4 multicast routing, skipping ..."); + + return -1; + } ++#ifndef SOCK_CLOEXEC ++ if (fcntl(mroute4_socket, F_SETFD, FD_CLOEXEC) < 0) { ++ smclog(LOG_INIT, "Failed initializing IPv4 multicast routing API: %m"); ++ close(mroute4_socket); ++ mroute4_socket = -1; ++ ++ return -1; ++ } ++#endif + + if (setsockopt(mroute4_socket, IPPROTO_IP, MRT_INIT, (void *)&arg, sizeof(arg))) { + switch (errno) { +@@ -472,12 +485,25 @@ int mroute6_enable(void) + unsigned int i; + struct iface *iface; + ++#ifdef SOCK_CLOEXEC + if ((mroute6_socket = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6)) < 0) { ++#else ++ if ((mroute6_socket = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) { ++#endif + if (ENOPROTOOPT == errno) + smclog(LOG_WARNING, "Kernel does not support IPv6 multicast routing, skipping ..."); + + return -1; + } ++#ifndef SOCK_CLOEXEC ++ if (fcntl(mroute6_socket, F_SETFD, FD_CLOEXEC) < 0) { ++ smclog(LOG_INIT, "Failed initializing IPv6 multicast routing API: %m"); ++ close(mroute6_socket); ++ mroute6_socket = -1; ++ ++ return -1; ++ } ++#endif + if (setsockopt(mroute6_socket, IPPROTO_IPV6, MRT6_INIT, (void *)&arg, sizeof(arg))) { + switch (errno) { + case EADDRINUSE: |