aboutsummaryrefslogtreecommitdiff
path: root/patches/openssl.c.patch
blob: 275e9ea6f38e572b8d16dd228adc9a91f4785f64 (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
--- apps/openssl.c.orig	2015-07-20 02:01:42.000000000 -0600
+++ apps/openssl.c	2015-07-20 02:02:00.000000000 -0600
@@ -130,6 +130,19 @@
 #include <openssl/engine.h>
 #endif

+#ifdef _WIN32
+#include <io.h>
+#include <fcntl.h>
+static void set_stdio_binary(void)
+{
+	_setmode(_fileno(stdin), _O_BINARY);
+	_setmode(_fileno(stdout), _O_BINARY);
+	_setmode(_fileno(stderr), _O_BINARY);
+}
+#else
+static void set_stdio_binary(void) {};
+#endif
+
 #include "progs.h"
 #include "s_apps.h"

@@ -204,7 +216,9 @@
 static void
 openssl_startup(void)
 {
+#ifndef _WIN32
 	signal(SIGPIPE, SIG_IGN);
+#endif

 	CRYPTO_malloc_init();
 	OpenSSL_add_all_algorithms();
@@ -216,6 +230,7 @@
 #endif

 	setup_ui_method();
+	set_stdio_binary();
 }

 static void