diff options
| author | Goetz Lindenmaier <goetz@openjdk.org> | 2026-06-02 13:16:37 +0000 |
|---|---|---|
| committer | Goetz Lindenmaier <goetz@openjdk.org> | 2026-06-02 13:16:37 +0000 |
| commit | fb416303b6fa9a07525bb407da59b34e42657e4c (patch) | |
| tree | d03e32101cc8fbfbe685a8dd0b586b1b79ff29e4 /src/java.base/unix/native/libjava | |
| parent | 2d847f7fff2ac4798d16f2da6948f779d426cf51 (diff) | |
| download | openjdk-fb416303b6fa9a07525bb407da59b34e42657e4c.tar.gz openjdk-fb416303b6fa9a07525bb407da59b34e42657e4c.zip | |
8366261: Provide utility methods for sun.security.util.Password
Reviewed-by: andrew, fitzsim, rschmelter
Backport-of: 91417890a24450d7cb23d188df4f631304d41ed6
Diffstat (limited to 'src/java.base/unix/native/libjava')
| -rw-r--r-- | src/java.base/unix/native/libjava/Console_md.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/java.base/unix/native/libjava/Console_md.c b/src/java.base/unix/native/libjava/Console_md.c index 829ceada934..e8b0a078930 100644 --- a/src/java.base/unix/native/libjava/Console_md.c +++ b/src/java.base/unix/native/libjava/Console_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,10 +32,21 @@ #include <unistd.h> #include <termios.h> -JNIEXPORT jboolean JNICALL -Java_java_io_Console_istty(JNIEnv *env, jclass cls) +JNIEXPORT jint JNICALL +Java_java_io_Console_ttyStatus(JNIEnv *env, jclass cls) { - return isatty(fileno(stdin)) && isatty(fileno(stdout)); + jint ret = 0; + + if (isatty(fileno(stdin))) { + ret |= java_io_Console_TTY_STDIN_MASK; + } + if (isatty(fileno(stdout))) { + ret |= java_io_Console_TTY_STDOUT_MASK; + } + if (isatty(fileno(stderr))) { + ret |= java_io_Console_TTY_STDERR_MASK; + } + return ret; } JNIEXPORT jstring JNICALL |
