From 909950b37472be15af43bcfc1c035cc72a1fad41 Mon Sep 17 00:00:00 2001 From: OpenJDK Team Date: Mon, 9 Sep 2024 15:48:20 +0200 Subject: [PATCH] libpcsclite-dlopen Gbp-Pq: Name libpcsclite-dlopen.diff --- .../security/smartcardio/PlatformPCSC.java | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java index 38fa3da9e..d5dd004cc 100644 --- a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java +++ b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java @@ -46,6 +46,7 @@ class PlatformPCSC { private final static String PROP_NAME = "sun.security.smartcardio.library"; + private final static String LIB0 = "libpcsclite.so.1"; private final static String LIB1 = "/usr/$LIBISA/libpcsclite.so"; private final static String LIB2 = "/usr/local/$LIBISA/libpcsclite.so"; private final static String PCSC_FRAMEWORK = "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC"; @@ -98,40 +99,9 @@ class PlatformPCSC { if (lib.length() != 0) { return lib; } - lib = expand(LIB1); - if (new File(lib).isFile()) { - // if LIB1 exists, use that - return lib; - } - lib = expand(LIB2); - if (new File(lib).isFile()) { - // if LIB2 exists, use that - return lib; - } - - // As of macos 11, framework libraries have been removed from the file - // system, but in such a way that they can still be dlopen()ed, even - // though they can no longer be open()ed. - // - // https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes - // - // """New in macOS Big Sur 11.0.1, the system ships with a built-in - // dynamic linker cache of all system-provided libraries. As part of - // this change, copies of dynamic libraries are no longer present on - // the filesystem. Code that attempts to check for dynamic library - // presence by looking for a file at a path or enumerating a directory - // will fail. Instead, check for library presence by attempting to - // dlopen() the path, which will correctly check for the library in the - // cache.""" - // - // The directory structure remains otherwise intact, so check for - // existence of the containing directory instead of the file. - lib = PCSC_FRAMEWORK; - if (new File(lib).getParentFile().isDirectory()) { - // if PCSC.framework exists, use that - return lib; - } - throw new IOException("No PC/SC library found on this system"); + // let dlopen do the work + lib = LIB0; + return lib; } private static native void initialize(String libraryName); -- 2.30.2