diff options
author | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2013-11-06 15:54:40 +0000 |
---|---|---|
committer | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2013-11-06 15:54:40 +0000 |
commit | e3104663df0cfab6436189ae73861d6491319cfa (patch) | |
tree | 2100ed46c2d8e5eab17527c68fcccb7670c4bc69 /configure.in | |
parent | d85fa3e6a7cdc6659e2aefc2d7af75722d58fd4a (diff) | |
download | libapr-e3104663df0cfab6436189ae73861d6491319cfa.tar.gz |
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
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1539374 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/configure.in b/configure.in index 55c395242..157954bb0 100644 --- a/configure.in +++ b/configure.in @@ -961,13 +961,17 @@ AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4], #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); |