aboutsummaryrefslogtreecommitdiff
path: root/patches/win_bio_sock_init.diff
blob: e0221b9aac9e81125092b905d877387947187e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index e7dd11c..cfd4593 100644
--- a/src/usr.bin/openssl/openssl.c
+++ b/src/usr.bin/openssl/openssl.c
@@ -253,6 +253,11 @@ main(int argc, char **argv)
 	arg.data = NULL;
 	arg.count = 0;
 
+	if (BIO_sock_init() != 1) {
+		fprintf(stderr, "BIO_sock_init failed\n");
+		exit(1);
+	}
+
 	bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 	if (bio_err == NULL) {
 		fprintf(stderr, "openssl: failed to initialise bio_err\n");
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c
index 3b96b1a..2ce31eb 100644
--- a/src/usr.bin/openssl/s_socket.c
+++ b/src/usr.bin/openssl/s_socket.c
@@ -85,11 +85,6 @@ init_client(int *sock, char *host, char *port, int type, int af)
 	struct addrinfo hints, *ai_top, *ai;
 	int i, s;
 
-	if (BIO_sock_init() != 1) {
-		BIO_printf(bio_err, "BIO_sock_init failed\n");
-		return (0);
-	}
-
 	memset(&hints, '\0', sizeof(hints));
 	hints.ai_family = af;
 	hints.ai_socktype = type;
@@ -181,11 +176,6 @@ init_server_long(int *sock, int port, char *ip, int type)
 	struct sockaddr_in server;
 	int s = -1;
 
-	if (BIO_sock_init() != 1) {
-		BIO_printf(bio_err, "BIO_sock_init failed\n");
-		return (0);
-	}
-
 	memset((char *) &server, 0, sizeof(server));
 	server.sin_family = AF_INET;
 	server.sin_port = htons((unsigned short) port);