summaryrefslogtreecommitdiff
path: root/net/smcroute/files/patch-ipc.c
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2016-06-14 07:39:24 +0000
committerHiroki Sato <hrs@FreeBSD.org>2016-06-14 07:39:24 +0000
commitc7753f7164d821de6a782b21b1a67a080140379a (patch)
tree5f72df174e1bf9f8f9ecf04d3657f1ae48176573 /net/smcroute/files/patch-ipc.c
parent- Update to 2.9 (diff)
Fix build on 9.x.
Notes
Notes: svn path=/head/; revision=416877
Diffstat (limited to 'net/smcroute/files/patch-ipc.c')
-rw-r--r--net/smcroute/files/patch-ipc.c52
1 files changed, 52 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