apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1539374 - /apr/apr/trunk/configure.in
Date Wed, 06 Nov 2013 15:54:41 GMT
Author: sf
Date: Wed Nov  6 15:54:40 2013
New Revision: 1539374

URL: http://svn.apache.org/r1539374
Log:
Use fcntl instead of SOCK_NONBLOCK to make socket nonblocking
in accept4 check.

There are platforms (e.g. Hurd) that support SOCK_NONBLOCK only
with accept4(), but not with socket(). See
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=715028

Modified:
    apr/apr/trunk/configure.in

Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=1539374&r1=1539373&r2=1539374&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Wed Nov  6 15:54:40 2013
@@ -961,13 +961,17 @@ AC_CACHE_CHECK([for accept4 support], [a
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 int main(int argc, char **argv)
 {
-    int fd;
+    int fd, flags;
     struct sockaddr_in sin;
 
-    if ((fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0)) == -1)
+    if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+        return 1;
+    if (fcntl(fd, F_GETFL, &flags) == -1 ||
+        fcntl(fd, F_SETFL, flags|O_NONBLOCK) == -1)
         return 1;
 
     memset(&sin, 0, sizeof sin);



Mime
View raw message