aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2015-12-11 09:22:12 -0600
committerBrent Cook <bcook@openbsd.org>2015-12-11 09:22:12 -0600
commit3af1387b189074ef82410627f51b84277aa24aa2 (patch)
treef235a18392c8122d65b01b4784715bd0605ec78a /crypto
parentbd8fe5868f40a80012749a0daa3af88b95b8fb22 (diff)
downloadportable-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.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/compat/ui_openssl_win.c12
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)
314static int 314static int
315noecho_console(UI *ui) 315noecho_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)
327static int 327static int
328echo_console(UI *ui) 328echo_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