]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/bio/b_sock.c
Reorganize local header files
[thirdparty/openssl.git] / crypto / bio / b_sock.c
index 9877b3d78df15061c192bde6155436d897c9120f..8e40d8644c258ac5f8f18c48f6d3f4b21b759ec0 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
-#include "bio_lcl.h"
+#include "bio_local.h"
 #ifndef OPENSSL_NO_SOCK
 # define SOCKET_PROTOCOL IPPROTO_TCP
 # ifdef SO_MAXCONN
@@ -120,8 +120,6 @@ int BIO_sock_init(void)
     static struct WSAData wsa_state;
 
     if (!wsa_init_done) {
-        int err;
-
         wsa_init_done = 1;
         memset(&wsa_state, 0, sizeof(wsa_state));
         /*
@@ -131,8 +129,8 @@ int BIO_sock_init(void)
          * probed at run-time with DSO_global_lookup.
          */
         if (WSAStartup(0x0202, &wsa_state) != 0) {
-            err = WSAGetLastError();
-            SYSerr(SYS_F_WSASTARTUP, err);
+            ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
+                           "calling wsastartup()");
             BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP);
             return -1;
         }
@@ -192,7 +190,8 @@ int BIO_socket_ioctl(int fd, long type, void *arg)
     i = ioctlsocket(fd, type, ARG);
 #  endif                        /* __DJGPP__ */
     if (i < 0)
-        SYSerr(SYS_F_IOCTLSOCKET, get_last_socket_error());
+        ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
+                       "calling ioctlsocket()");
     return i;
 }
 
@@ -243,7 +242,8 @@ int BIO_accept(int sock, char **ip_port)
             ret = -2;
             goto end;
         }
-        SYSerr(SYS_F_ACCEPT, get_last_socket_error());
+        ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
+                       "calling accept()");
         BIOerr(BIO_F_BIO_ACCEPT, BIO_R_ACCEPT_ERROR);
         goto end;
     }
@@ -308,7 +308,8 @@ int BIO_socket_nbio(int s, int mode)
 
     l = fcntl(s, F_GETFL, 0);
     if (l == -1) {
-        SYSerr(SYS_F_FCNTL, get_last_sys_error());
+        ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
+                       "calling fcntl()");
         ret = -1;
     } else {
 #  if defined(O_NONBLOCK)
@@ -326,7 +327,8 @@ int BIO_socket_nbio(int s, int mode)
         ret = fcntl(s, F_SETFL, l);
 
         if (ret < 0) {
-            SYSerr(SYS_F_FCNTL, get_last_sys_error());
+            ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
+                           "calling fcntl()");
         }
     }
 # else
@@ -349,7 +351,8 @@ int BIO_sock_info(int sock,
             ret = getsockname(sock, BIO_ADDR_sockaddr_noconst(info->addr),
                               &addr_len);
             if (ret == -1) {
-                SYSerr(SYS_F_GETSOCKNAME, get_last_socket_error());
+                ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
+                               "calling getsockname()");
                 BIOerr(BIO_F_BIO_SOCK_INFO, BIO_R_GETSOCKNAME_ERROR);
                 return 0;
             }