about summary refs log tree commit homepage
path: root/ext/kgio/missing/accept4.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kgio/missing/accept4.h')
-rw-r--r--ext/kgio/missing/accept4.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/ext/kgio/missing/accept4.h b/ext/kgio/missing/accept4.h
index 8fc37c4..cd8be79 100644
--- a/ext/kgio/missing/accept4.h
+++ b/ext/kgio/missing/accept4.h
@@ -1,7 +1,4 @@
-#ifdef HAVE_ACCEPT4
-#  define A4_SOCK_CLOEXEC SOCK_CLOEXEC
-#  define A4_SOCK_NONBLOCK SOCK_NONBLOCK
-#else
+#ifndef HAVE_ACCEPT4
 #  ifndef _GNU_SOURCE
 #    define _GNU_SOURCE
 #  endif
@@ -9,15 +6,12 @@
 #  include <sys/socket.h>
 #  ifndef SOCK_CLOEXEC
 #    if (FD_CLOEXEC == O_NONBLOCK)
-#      define A4_SOCK_CLOEXEC 1
-#      define A4_SOCK_NONBLOCK 2
+#      define SOCK_CLOEXEC 1
+#      define SOCK_NONBLOCK 2
 #    else
-#      define A4_SOCK_CLOEXEC FD_CLOEXEC
-#      define A4_SOCK_NONBLOCK O_NONBLOCK
+#      define SOCK_CLOEXEC FD_CLOEXEC
+#      define SOCK_NONBLOCK O_NONBLOCK
 #    endif
-#  else
-#    define A4_SOCK_CLOEXEC SOCK_CLOEXEC
-#    define A4_SOCK_NONBLOCK SOCK_NONBLOCK
 #  endif
 
 /* accept4() is currently a Linux-only goodie */
@@ -27,7 +21,7 @@ accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
         int fd = accept(sockfd, addr, addrlen);
 
         if (fd >= 0) {
-                if ((flags & A4_SOCK_CLOEXEC) == A4_SOCK_CLOEXEC)
+                if ((flags & SOCK_CLOEXEC) == SOCK_CLOEXEC)
                         (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
 
                 /*
@@ -36,7 +30,7 @@ accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
                  * Linux, so fcntl() is completely unnecessary
                  * in most cases...
                  */
-                if ((flags & A4_SOCK_NONBLOCK) == A4_SOCK_NONBLOCK) {
+                if ((flags & SOCK_NONBLOCK) == SOCK_NONBLOCK) {
                         int fl = fcntl(fd, F_GETFL);
 
                         if ((fl & O_NONBLOCK) == 0)