summaryrefslogtreecommitdiffstats
path: root/contrib/apr/network_io/unix
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/apr/network_io/unix')
-rw-r--r--contrib/apr/network_io/unix/sockaddr.c10
-rw-r--r--contrib/apr/network_io/unix/sockets.c34
2 files changed, 36 insertions, 8 deletions
diff --git a/contrib/apr/network_io/unix/sockaddr.c b/contrib/apr/network_io/unix/sockaddr.c
index 0dd1a2d..e6d7e0b 100644
--- a/contrib/apr/network_io/unix/sockaddr.c
+++ b/contrib/apr/network_io/unix/sockaddr.c
@@ -325,6 +325,16 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa,
hints.ai_flags = AI_ADDRCONFIG;
}
#endif
+
+#ifdef __MVS__
+ /* z/OS will not return IPv4 address under AF_UNSPEC if any IPv6 results
+ * are returned, w/o AI_ALL.
+ */
+ if (family == APR_UNSPEC) {
+ hints.ai_flags |= AI_ALL;
+ }
+#endif
+
if(hostname == NULL) {
#ifdef AI_PASSIVE
/* If hostname is NULL, assume we are trying to bind to all
diff --git a/contrib/apr/network_io/unix/sockets.c b/contrib/apr/network_io/unix/sockets.c
index 514edb1..b95794f 100644
--- a/contrib/apr/network_io/unix/sockets.c
+++ b/contrib/apr/network_io/unix/sockets.c
@@ -145,13 +145,22 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type,
#ifndef HAVE_SOCK_CLOEXEC
{
int flags;
+ apr_status_t rv;
- if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1)
- return errno;
+ if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) {
+ rv = errno;
+ close((*new)->socketdes);
+ (*new)->socketdes = -1;
+ return rv;
+ }
flags |= FD_CLOEXEC;
- if (fcntl((*new)->socketdes, F_SETFD, flags) == -1)
- return errno;
+ if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) {
+ rv = errno;
+ close((*new)->socketdes);
+ (*new)->socketdes = -1;
+ return rv;
+ }
}
#endif
@@ -306,13 +315,22 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock,
#ifndef HAVE_ACCEPT4
{
int flags;
+ apr_status_t rv;
- if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1)
- return errno;
+ if ((flags = fcntl((*new)->socketdes, F_GETFD)) == -1) {
+ rv = errno;
+ close((*new)->socketdes);
+ (*new)->socketdes = -1;
+ return rv;
+ }
flags |= FD_CLOEXEC;
- if (fcntl((*new)->socketdes, F_SETFD, flags) == -1)
- return errno;
+ if (fcntl((*new)->socketdes, F_SETFD, flags) == -1) {
+ rv = errno;
+ close((*new)->socketdes);
+ (*new)->socketdes = -1;
+ return rv;
+ }
}
#endif
OpenPOWER on IntegriCloud