diff options
| author | Brent Cook <bcook@openbsd.org> | 2015-12-11 09:22:12 -0600 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2015-12-11 09:22:12 -0600 |
| commit | 3af1387b189074ef82410627f51b84277aa24aa2 (patch) | |
| tree | f235a18392c8122d65b01b4784715bd0605ec78a | |
| parent | bd8fe5868f40a80012749a0daa3af88b95b8fb22 (diff) | |
| download | portable-3af1387b189074ef82410627f51b84277aa24aa2.tar.gz portable-3af1387b189074ef82410627f51b84277aa24aa2.tar.bz2 portable-3af1387b189074ef82410627f51b84277aa24aa2.zip | |
Revert back to GetStdHandle, since it works fine with pipes.
Also include the formerly-missing NULL check, since this can fail in two
ways.
| -rw-r--r-- | crypto/compat/ui_openssl_win.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/compat/ui_openssl_win.c b/crypto/compat/ui_openssl_win.c index 959352b..ad9e915 100644 --- a/crypto/compat/ui_openssl_win.c +++ b/crypto/compat/ui_openssl_win.c | |||
| @@ -301,8 +301,8 @@ open_console(UI *ui) | |||
| 301 | tty_in = stdin; | 301 | tty_in = stdin; |
| 302 | tty_out = stderr; | 302 | tty_out = stderr; |
| 303 | 303 | ||
| 304 | HANDLE handle = (HANDLE)_get_osfhandle(_fileno(stdin)); | 304 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
| 305 | if (handle != INVALID_HANDLE_VALUE) { | 305 | if (handle != NULL && handle != INVALID_HANDLE_VALUE) { |
| 306 | if (GetFileType(handle) == FILE_TYPE_CHAR) | 306 | if (GetFileType(handle) == FILE_TYPE_CHAR) |
| 307 | return GetConsoleMode(handle, &console_mode); | 307 | return GetConsoleMode(handle, &console_mode); |
| 308 | else | 308 | else |
| @@ -314,8 +314,8 @@ open_console(UI *ui) | |||
| 314 | static int | 314 | static int |
| 315 | noecho_console(UI *ui) | 315 | noecho_console(UI *ui) |
| 316 | { | 316 | { |
| 317 | HANDLE handle = (HANDLE)_get_osfhandle(_fileno(stdin)); | 317 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
| 318 | if (handle != INVALID_HANDLE_VALUE) { | 318 | if (handle != NULL && handle != INVALID_HANDLE_VALUE) { |
| 319 | if (GetFileType(handle) == FILE_TYPE_CHAR) | 319 | if (GetFileType(handle) == FILE_TYPE_CHAR) |
| 320 | return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT); | 320 | return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT); |
| 321 | else | 321 | else |
| @@ -327,8 +327,8 @@ noecho_console(UI *ui) | |||
| 327 | static int | 327 | static int |
| 328 | echo_console(UI *ui) | 328 | echo_console(UI *ui) |
| 329 | { | 329 | { |
| 330 | HANDLE handle = (HANDLE)_get_osfhandle(_fileno(stdin)); | 330 | HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
| 331 | if (handle != INVALID_HANDLE_VALUE) { | 331 | if (handle != NULL && handle != INVALID_HANDLE_VALUE) { |
| 332 | if (GetFileType(handle) == FILE_TYPE_CHAR) | 332 | if (GetFileType(handle) == FILE_TYPE_CHAR) |
| 333 | return SetConsoleMode(handle, console_mode); | 333 | return SetConsoleMode(handle, console_mode); |
| 334 | else | 334 | else |
