Blame SOURCES/rh1929465-dont_define_unused_throwioexception.patch

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