[pulseaudio-discuss] [PATCH] netbsd: NetBSD ships with paccept(2) a superset of Linux-specific accept4()

Kamil Rytarowski n54 at gmx.com
Sat Nov 21 14:08:23 PST 2015


---
 configure.ac              | 2 +-
 src/pulsecore/core-util.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 003673e..24ba7ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -572,7 +572,7 @@ AC_CHECK_FUNCS_ONCE([strerror_r])
 AC_CHECK_FUNCS_ONCE([lstat])
 
 # Non-standard
-AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid ppoll strsignal sig2str strtod_l pipe2 accept4])
+AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid ppoll strsignal sig2str strtod_l pipe2 accept4 paccept])
 
 AC_FUNC_ALLOCA
 
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 2099686..b5ddd3d 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -3501,6 +3501,8 @@ finish:
 int pa_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
     int fd;
 
+    errno = 0;
+
 #ifdef HAVE_ACCEPT4
     if ((fd = accept4(sockfd, addr, addrlen, SOCK_CLOEXEC)) >= 0)
         goto finish;
@@ -3510,6 +3512,11 @@ int pa_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
 
 #endif
 
+#ifdef HAVE_PACCEPT
+    if ((fd = paccept(sockfd, addr, addrlen, NULL, SOCK_CLOEXEC)) >= 0)
+        goto finish;
+#endif
+
     if ((fd = accept(sockfd, addr, addrlen)) >= 0)
         goto finish;
 
-- 
2.6.3



More information about the pulseaudio-discuss mailing list