mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8194750: Console.readPassword does not save/restore tty settings
Reviewed-by: martin, alanb
This commit is contained in:
parent
97979a53a1
commit
1775d925de
3 changed files with 45 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue