diff options
author | Matt Caswell <matt@openssl.org> | 2016-05-20 11:53:26 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-27 15:18:46 +0100 |
commit | 75dd6c1a39c4e73de7d8d782adb7008645248f50 (patch) | |
tree | e5c004d97e12eb00ba6e51e4938905b861788c74 /apps/s_server.c | |
parent | 384f08dc76e4df2c004042bd9b1bad60f98c281f (diff) |
Fix s_client/s_server waiting for stdin on Windows
On Windows we were using the function _kbhit() to determine whether there
was input waiting in stdin for us to read. Actually all this does is work
out whether there is a keyboard press event waiting to be processed in the
input buffer. This only seems to work in a standard Windows console (not
Msys console) and also doesn't work if you redirect the input from some
other source (as we do in TLSProxy tests). This commit changes things to
work differently depending on whether we are on the Windows console or not.
RT#4255
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/s_server.c')
-rw-r--r-- | apps/s_server.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/s_server.c b/apps/s_server.c index 7271b611ef..08753c30fd 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2167,10 +2167,10 @@ static int sv_body(int s, int stype, unsigned char *context) tv.tv_sec = 1; tv.tv_usec = 0; i = select(width, (void *)&readfds, NULL, NULL, &tv); - if ((i < 0) || (!i && !_kbhit())) - continue; - if (_kbhit()) + if (has_stdin_waiting()) read_from_terminal = 1; + if ((i < 0) || (!i && !read_from_terminal)) + continue; #else if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_get_timeout(con, &timeout)) |