Blame SOURCES/rh1929465-dont_define_unused_throwioexception.patch

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