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

@ -67,3 +67,14 @@ Java_java_io_Console_echo(JNIEnv *env,
}
return old;
}
JNIEXPORT jboolean JNICALL
Java_java_io_Console_echo0(JNIEnv *env, jclass cls) {
struct termios tio;
int tty = fileno(stdin);
if (tcgetattr(tty, &tio) == -1) {
JNU_ThrowIOExceptionWithLastError(env, "tcgetattr failed");
return JNI_TRUE;
}
return (tio.c_lflag & ECHO) != 0;
}