Browse Source

openssl: fix keypress requirement in apps on win32

Reapply b910613792 .

Fixes: https://github.com/iojs/io.js/issues/589
PR-URL: https://github.com/iojs/io.js/pull/1389
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v4.x
Shigeki Ohtsu 10 years ago
committed by Myles Borins
parent
commit
baedfbae6a
  1. 20
      deps/openssl/openssl/apps/s_client.c

20
deps/openssl/openssl/apps/s_client.c

@ -180,6 +180,13 @@ typedef unsigned int u_int;
# include <fcntl.h> # include <fcntl.h>
#endif #endif
/* Use Windows API with STD_INPUT_HANDLE when checking for input?
Don't look at OPENSSL_SYS_MSDOS for this, since it is always defined if
OPENSSL_SYS_WINDOWS is defined */
#if defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_WINCE) && defined(STD_INPUT_HANDLE)
#define OPENSSL_USE_STD_INPUT_HANDLE
#endif
#undef PROG #undef PROG
#define PROG s_client_main #define PROG s_client_main
@ -1764,10 +1771,7 @@ int MAIN(int argc, char **argv)
tv.tv_usec = 0; tv.tv_usec = 0;
i = select(width, (void *)&readfds, (void *)&writefds, i = select(width, (void *)&readfds, (void *)&writefds,
NULL, &tv); NULL, &tv);
# if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS) #if defined(OPENSSL_USE_STD_INPUT_HANDLE)
if (!i && (!_kbhit() || !read_tty))
continue;
# else
if (!i && (!((_kbhit()) if (!i && (!((_kbhit())
|| (WAIT_OBJECT_0 == || (WAIT_OBJECT_0 ==
WaitForSingleObject(GetStdHandle WaitForSingleObject(GetStdHandle
@ -1775,6 +1779,8 @@ int MAIN(int argc, char **argv)
0))) 0)))
|| !read_tty)) || !read_tty))
continue; continue;
#else
if(!i && (!_kbhit() || !read_tty) ) continue;
# endif # endif
} else } else
i = select(width, (void *)&readfds, (void *)&writefds, i = select(width, (void *)&readfds, (void *)&writefds,
@ -1976,12 +1982,12 @@ int MAIN(int argc, char **argv)
} }
} }
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
# if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS) #if defined(OPENSSL_USE_STD_INPUT_HANDLE)
else if (_kbhit())
# else
else if ((_kbhit()) else if ((_kbhit())
|| (WAIT_OBJECT_0 == || (WAIT_OBJECT_0 ==
WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
#else
else if (_kbhit())
# endif # endif
#elif defined (OPENSSL_SYS_NETWARE) #elif defined (OPENSSL_SYS_NETWARE)
else if (_kbhit()) else if (_kbhit())

Loading…
Cancel
Save