src/solaris/native/java/lang/java_props_macosx.c
Print this page
@@ -143,31 +143,26 @@
if (isInAquaSession()) return pref = CToolkit;
if (isXDisplayDefined()) return pref = XToolkit;
return pref = HToolkit;
}
-void setUnknownOSAndVersion(java_props_t *sprops) {
- sprops->os_name = strdup("Unknown");
- sprops->os_version = strdup("Unknown");
-}
-
void setOSNameAndVersion(java_props_t *sprops) {
- void *jrsFwk = getJRSFramework();
- if (jrsFwk == NULL) {
- setUnknownOSAndVersion(sprops);
- return;
- }
+ /* Don't rely on JRSCopyOSName because there's no guarantee the value will
+ * remain the same, or even if the JRS functions will continue to be part of
+ * Mac OS X. So hardcode os_name, and fill in os_version if we can.
+ */
+ sprops->os_name = strdup("Mac OS X");
- char *(*copyOSName)() = dlsym(jrsFwk, "JRSCopyOSName");
+ void *jrsFwk = getJRSFramework();
+ if (jrsFwk != NULL) {
char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion");
- if (copyOSName == NULL || copyOSVersion == NULL) {
- setUnknownOSAndVersion(sprops);
+ if (copyOSVersion != NULL) {
+ sprops->os_version = copyOSVersion();
return;
}
-
- sprops->os_name = copyOSName();
- sprops->os_version = copyOSVersion();
+ }
+ sprops->os_version = strdup("Unknown");
}
static Boolean getProxyInfoForProtocol(CFDictionaryRef inDict, CFStringRef inEnabledKey, CFStringRef inHostKey, CFStringRef inPortKey, CFStringRef *outProxyHost, int *ioProxyPort) {
/* See if the proxy is enabled. */