Skip to content

Commit 116c546

Browse files
author
Shigeki Ohtsu
committed
openssl: fix keypress requirement in apps on win32
Reapply b910613 . Fixes: #589 PR-URL: #1389 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent ae8831f commit 116c546

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

deps/openssl/openssl/apps/s_client.c

+13-7
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ typedef unsigned int u_int;
180180
# include <fcntl.h>
181181
#endif
182182

183+
/* Use Windows API with STD_INPUT_HANDLE when checking for input?
184+
Don't look at OPENSSL_SYS_MSDOS for this, since it is always defined if
185+
OPENSSL_SYS_WINDOWS is defined */
186+
#if defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_WINCE) && defined(STD_INPUT_HANDLE)
187+
#define OPENSSL_USE_STD_INPUT_HANDLE
188+
#endif
189+
183190
#undef PROG
184191
#define PROG s_client_main
185192

@@ -1757,17 +1764,16 @@ int MAIN(int argc, char **argv)
17571764
tv.tv_usec = 0;
17581765
i = select(width, (void *)&readfds, (void *)&writefds,
17591766
NULL, &tv);
1760-
# if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
1761-
if (!i && (!_kbhit() || !read_tty))
1762-
continue;
1763-
# else
1767+
#if defined(OPENSSL_USE_STD_INPUT_HANDLE)
17641768
if (!i && (!((_kbhit())
17651769
|| (WAIT_OBJECT_0 ==
17661770
WaitForSingleObject(GetStdHandle
17671771
(STD_INPUT_HANDLE),
17681772
0)))
17691773
|| !read_tty))
17701774
continue;
1775+
#else
1776+
if(!i && (!_kbhit() || !read_tty) ) continue;
17711777
# endif
17721778
} else
17731779
i = select(width, (void *)&readfds, (void *)&writefds,
@@ -1969,12 +1975,12 @@ int MAIN(int argc, char **argv)
19691975
}
19701976
}
19711977
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
1972-
# if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
1973-
else if (_kbhit())
1974-
# else
1978+
#if defined(OPENSSL_USE_STD_INPUT_HANDLE)
19751979
else if ((_kbhit())
19761980
|| (WAIT_OBJECT_0 ==
19771981
WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
1982+
#else
1983+
else if (_kbhit())
19781984
# endif
19791985
#elif defined (OPENSSL_SYS_NETWARE)
19801986
else if (_kbhit())

0 commit comments

Comments
 (0)