7178922: (props) re-visit how os.name is determined on Mac
Reviewed-by: alanb, mchung, skovatch, serb
--- a/jdk/src/solaris/native/java/lang/java_props_macosx.c Fri Nov 16 12:28:45 2012 -0800
+++ b/jdk/src/solaris/native/java/lang/java_props_macosx.c Fri Nov 16 17:01:19 2012 -0800
@@ -145,27 +145,22 @@
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) {
+ /* 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");
-void setOSNameAndVersion(java_props_t *sprops) {
void *jrsFwk = getJRSFramework();
- if (jrsFwk == NULL) {
- setUnknownOSAndVersion(sprops);
- return;
+ if (jrsFwk != NULL) {
+ char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion");
+ if (copyOSVersion != NULL) {
+ sprops->os_version = copyOSVersion();
+ return;
+ }
}
-
- char *(*copyOSName)() = dlsym(jrsFwk, "JRSCopyOSName");
- char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion");
- if (copyOSName == NULL || copyOSVersion == NULL) {
- setUnknownOSAndVersion(sprops);
- return;
- }
-
- sprops->os_name = copyOSName();
- sprops->os_version = copyOSVersion();
+ sprops->os_version = strdup("Unknown");
}