diff options
author | Brent Cook <bcook@openbsd.org> | 2015-09-13 09:19:26 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2015-09-13 09:31:41 -0500 |
commit | a896d400a0bd65512e7c779306aae7480ee079b4 (patch) | |
tree | db52c01b2569ea9e6d8209694c232c86a37af63c | |
parent | 653bbfaabf6f089c15118df821e51bea75ab7792 (diff) | |
download | portable-a896d400a0bd65512e7c779306aae7480ee079b4.tar.gz portable-a896d400a0bd65512e7c779306aae7480ee079b4.tar.bz2 portable-a896d400a0bd65512e7c779306aae7480ee079b4.zip |
move windows file IO mode setup to apps_win.c
-rw-r--r-- | apps/openssl/compat/apps_win.c | 31 | ||||
-rw-r--r-- | patches/openssl.c.patch | 38 |
2 files changed, 36 insertions, 33 deletions
diff --git a/apps/openssl/compat/apps_win.c b/apps/openssl/compat/apps_win.c index 496ac03..37bfcc9 100644 --- a/apps/openssl/compat/apps_win.c +++ b/apps/openssl/compat/apps_win.c | |||
@@ -7,6 +7,9 @@ | |||
7 | 7 | ||
8 | #include <windows.h> | 8 | #include <windows.h> |
9 | 9 | ||
10 | #include <io.h> | ||
11 | #include <fcntl.h> | ||
12 | |||
10 | #include "apps.h" | 13 | #include "apps.h" |
11 | 14 | ||
12 | double | 15 | double |
@@ -27,3 +30,31 @@ app_tminterval(int stop, int usertime) | |||
27 | } | 30 | } |
28 | return 0; | 31 | return 0; |
29 | } | 32 | } |
33 | |||
34 | int | ||
35 | setup_ui(void) | ||
36 | { | ||
37 | ui_method = UI_create_method("OpenSSL application user interface"); | ||
38 | UI_method_set_opener(ui_method, ui_open); | ||
39 | UI_method_set_reader(ui_method, ui_read); | ||
40 | UI_method_set_writer(ui_method, ui_write); | ||
41 | UI_method_set_closer(ui_method, ui_close); | ||
42 | |||
43 | /* | ||
44 | * Set STDIO to binary | ||
45 | */ | ||
46 | _setmode(_fileno(stdin), _O_BINARY); | ||
47 | _setmode(_fileno(stdout), _O_BINARY); | ||
48 | _setmode(_fileno(stderr), _O_BINARY); | ||
49 | |||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | void | ||
54 | destroy_ui(void) | ||
55 | { | ||
56 | if (ui_method) { | ||
57 | UI_destroy_method(ui_method); | ||
58 | ui_method = NULL; | ||
59 | } | ||
60 | } | ||
diff --git a/patches/openssl.c.patch b/patches/openssl.c.patch index ba3ac36..57282aa 100644 --- a/patches/openssl.c.patch +++ b/patches/openssl.c.patch | |||
@@ -1,40 +1,12 @@ | |||
1 | --- apps/openssl/openssl.c.orig 2015-07-20 02:01:42.000000000 -0600 | 1 | --- apps/openssl/openssl.c.orig Sun Sep 13 09:11:31 2015 |
2 | +++ apps/openssl/openssl.c 2015-07-20 02:02:00.000000000 -0600 | 2 | +++ apps/openssl/openssl.c Sun Sep 13 09:10:02 2015 |
3 | @@ -130,6 +130,19 @@ | 3 | @@ -399,7 +399,9 @@ |
4 | #include <openssl/engine.h> | ||
5 | #endif | ||
6 | |||
7 | +#ifdef _WIN32 | ||
8 | +#include <io.h> | ||
9 | +#include <fcntl.h> | ||
10 | +static void set_stdio_binary(void) | ||
11 | +{ | ||
12 | + _setmode(_fileno(stdin), _O_BINARY); | ||
13 | + _setmode(_fileno(stdout), _O_BINARY); | ||
14 | + _setmode(_fileno(stderr), _O_BINARY); | ||
15 | +} | ||
16 | +#else | ||
17 | +static void set_stdio_binary(void) {}; | ||
18 | +#endif | ||
19 | + | ||
20 | #include "progs.h" | ||
21 | #include "s_apps.h" | ||
22 | |||
23 | @@ -204,7 +216,9 @@ | ||
24 | static void | 4 | static void |
25 | openssl_startup(void) | 5 | openssl_startup(void) |
26 | { | 6 | { |
27 | +#ifndef _WIN32 | 7 | +#ifndef _WIN32 |
28 | signal(SIGPIPE, SIG_IGN); | 8 | signal(SIGPIPE, SIG_IGN); |
29 | +#endif | 9 | +#endif |
30 | 10 | ||
31 | CRYPTO_malloc_init(); | ||
32 | OpenSSL_add_all_algorithms(); | 11 | OpenSSL_add_all_algorithms(); |
33 | @@ -216,6 +230,7 @@ | 12 | SSL_library_init(); |
34 | #endif | ||
35 | |||
36 | setup_ui_method(); | ||
37 | + set_stdio_binary(); | ||
38 | } | ||
39 | |||
40 | static void | ||