crypto/armcap.c: detect ARMv8 capabilities [in 32-bit build].
[openssl.git] / crypto / bio / b_sock.c
index 54112e6ebe4eaca20b5e7438bc114e0ece684ab7..a026b3e0b02c0370f2be61f95a003afd6d70bc75 100644 (file)
@@ -233,13 +233,14 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
 int BIO_sock_error(int sock)
        {
        int j,i;
-       int size;
+       union { size_t s; int i; } size;
                 
 #if defined(OPENSSL_SYS_BEOS_R5)
        return 0;
 #endif
-                
-       size=sizeof(int);
+       /* heuristic way to adapt for platforms that expect 64-bit optlen */
+       size.s=0, size.i=sizeof(j);
        /* Note: under Windows the third parameter is of type (char *)
         * whereas under other systems it is (void *) if you don't have
         * a cast it will choke the compiler: if you do have a cast then
@@ -683,6 +684,7 @@ int BIO_get_accept_socket(char *host, int bind_mode)
         * note that commonly IPv6 wildchard socket can service
         * IPv4 connections just as well...  */
        memset(&hint,0,sizeof(hint));
+       hint.ai_flags = AI_PASSIVE;
        if (h)
                {
                if (strchr(h,':'))
@@ -695,7 +697,10 @@ int BIO_get_accept_socket(char *host, int bind_mode)
 #endif
                        }
                else if (h[0]=='*' && h[1]=='\0')
+                       {
+                       hint.ai_family = AF_INET;
                        h=NULL;
+                       }
                }
 
        if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break;
@@ -956,7 +961,6 @@ int BIO_set_tcp_ndelay(int s, int on)
 #endif
        return(ret == 0);
        }
-#endif
 
 int BIO_socket_nbio(int s, int mode)
        {
@@ -969,3 +973,4 @@ int BIO_socket_nbio(int s, int mode)
 #endif
        return(ret == 0);
        }
+#endif