Blame SOURCES/rh1929465-dont_define_unused_throwioexception.patch

0a390a
commit 90e344e7d4987af610fa0054c92d18fe1c2edd41
0a390a
Author: Andrew Hughes <gnu.andrew@redhat.com>
0a390a
Date:   Sat Aug 28 01:15:28 2021 +0100
0a390a
0a390a
    RH1929465: Don't define unused throwIOException function when using NSS detection
0a390a
0a390a
diff --git openjdk.orig/src/java.base/linux/native/libsystemconf/systemconf.c openjdk/src/java.base/linux/native/libsystemconf/systemconf.c
0a390a
index 6f4656bfcb6..38919d6bb0f 100644
0a390a
--- openjdk.orig/src/java.base/linux/native/libsystemconf/systemconf.c
0a390a
+++ openjdk/src/java.base/linux/native/libsystemconf/systemconf.c
0a390a
@@ -34,14 +34,34 @@
0a390a
 
0a390a
 #include "java_security_SystemConfigurator.h"
0a390a
 
0a390a
-#define FIPS_ENABLED_PATH "/proc/sys/crypto/fips_enabled"
0a390a
 #define MSG_MAX_SIZE 96
0a390a
 
0a390a
 static jmethodID debugPrintlnMethodID = NULL;
0a390a
 static jobject debugObj = NULL;
0a390a
 
0a390a
-static void throwIOException(JNIEnv *env, const char *msg);
0a390a
-static void dbgPrint(JNIEnv *env, const char* msg);
0a390a
+// Only used when NSS is unavailable and FIPS_ENABLED_PATH is read
0a390a
+#ifndef SYSCONF_NSS
0a390a
+
0a390a
+#define FIPS_ENABLED_PATH "/proc/sys/crypto/fips_enabled"
0a390a
+
0a390a
+static void throwIOException(JNIEnv *env, const char *msg)
0a390a
+{
0a390a
+    jclass cls = (*env)->FindClass(env, "java/io/IOException");
0a390a
+    if (cls != 0)
0a390a
+        (*env)->ThrowNew(env, cls, msg);
0a390a
+}
0a390a
+
0a390a
+#endif
0a390a
+
0a390a
+static void dbgPrint(JNIEnv *env, const char* msg)
0a390a
+{
0a390a
+    jstring jMsg;
0a390a
+    if (debugObj != NULL) {
0a390a
+        jMsg = (*env)->NewStringUTF(env, msg);
0a390a
+        CHECK_NULL(jMsg);
0a390a
+        (*env)->CallVoidMethod(env, debugObj, debugPrintlnMethodID, jMsg);
0a390a
+    }
0a390a
+}
0a390a
 
0a390a
 /*
0a390a
  * Class:     java_security_SystemConfigurator
0a390a
@@ -149,20 +169,3 @@ JNIEXPORT jboolean JNICALL Java_java_security_SystemConfigurator_getSystemFIPSEn
0a390a
 
0a390a
 #endif // SYSCONF_NSS
0a390a
 }
0a390a
-
0a390a
-static void throwIOException(JNIEnv *env, const char *msg)
0a390a
-{
0a390a
-    jclass cls = (*env)->FindClass(env, "java/io/IOException");
0a390a
-    if (cls != 0)
0a390a
-        (*env)->ThrowNew(env, cls, msg);
0a390a
-}
0a390a
-
0a390a
-static void dbgPrint(JNIEnv *env, const char* msg)
0a390a
-{
0a390a
-    jstring jMsg;
0a390a
-    if (debugObj != NULL) {
0a390a
-        jMsg = (*env)->NewStringUTF(env, msg);
0a390a
-        CHECK_NULL(jMsg);
0a390a
-        (*env)->CallVoidMethod(env, debugObj, debugPrintlnMethodID, jMsg);
0a390a
-    }
0a390a
-}