aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2015-06-05 03:45:45 -0500
committerBrent Cook <bcook@openbsd.org>2015-06-05 04:50:18 -0500
commit1d27b22e82ce00d27d0886c8488e4cbed1cb618e (patch)
tree900465ad2494e1201651e9dcf1b8381ddd50e2be
parentb239fc25fcde7ec6f305fff290bc762d14397d15 (diff)
downloadportable-1d27b22e82ce00d27d0886c8488e4cbed1cb618e.tar.gz
portable-1d27b22e82ce00d27d0886c8488e4cbed1cb618e.tar.bz2
portable-1d27b22e82ce00d27d0886c8488e4cbed1cb618e.zip
set stdin/out/err to binary mode on Windows
-rw-r--r--patches/openssl.c.patch29
-rwxr-xr-xupdate.sh1
2 files changed, 30 insertions, 0 deletions
diff --git a/patches/openssl.c.patch b/patches/openssl.c.patch
new file mode 100644
index 0000000..c086ba5
--- /dev/null
+++ b/patches/openssl.c.patch
@@ -0,0 +1,29 @@
1--- apps/openssl.c.orig 2015-06-05 03:42:12.956112944 -0500
2+++ apps/openssl.c 2015-06-05 03:41:54.215381908 -0500
3@@ -130,6 +130,18 @@
4 #include <openssl/engine.h>
5 #endif
6
7+#ifdef _WIN32
8+#include <fcntl.h>
9+static void set_stdio_binary(void)
10+{
11+ _setmode(_fileno(stdin), _O_BINARY);
12+ _setmode(_fileno(stdout), _O_BINARY);
13+ _setmode(_fileno(stderr), _O_BINARY);
14+}
15+#else
16+static void set_stdio_binary(void) {};
17+#endif
18+
19 #include "progs.h"
20 #include "s_apps.h"
21
22@@ -216,6 +228,7 @@
23 #endif
24
25 setup_ui_method();
26+ set_stdio_binary();
27 }
28
29 static void
diff --git a/update.sh b/update.sh
index 722c637..232f029 100755
--- a/update.sh
+++ b/update.sh
@@ -210,6 +210,7 @@ for i in `awk '/SOURCES|HEADERS/ { print $3 }' apps/Makefile.am` ; do
210 $CP $openssl_app_src/$i apps 210 $CP $openssl_app_src/$i apps
211 fi 211 fi
212done 212done
213patch -p0 < patches/openssl.c.patch
213 214
214# copy libssl source 215# copy libssl source
215echo "copying libssl source" 216echo "copying libssl source"