8194750: Console.readPassword does not save/restore tty settings

Reviewed-by: martin, alanb
This commit is contained in:
Xueming Shen 2018-04-17 11:20:50 -07:00
parent 97979a53a1
commit 1775d925de
3 changed files with 45 additions and 6 deletions

View file

@ -82,3 +82,14 @@ Java_java_io_Console_echo(JNIEnv *env, jclass cls, jboolean on)
}
return old;
}
JNIEXPORT jboolean JNICALL
Java_java_io_Console_echo0(JNIEnv *env, jclass cls)
{
DWORD fdwMode;
if (! GetConsoleMode(hStdIn, &fdwMode)) {
JNU_ThrowIOExceptionWithLastError(env, "GetConsoleMode failed");
return JNI_TRUE;
}
return (fdwMode & ENABLE_ECHO_INPUT) != 0;
}