Blame SOURCES/rh1929465-dont_define_unused_throwioexception.patch

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