--- a/hotspot/src/os/windows/vm/os_windows.cpp Mon Mar 30 16:47:42 2015 +0000
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Mon Mar 30 17:32:18 2015 -0400
@@ -153,11 +153,6 @@
// Implementation of os
-bool os::getenv(const char* name, char* buffer, int len) {
- int result = GetEnvironmentVariable(name, buffer, len);
- return result > 0 && result < len;
-}
-
bool os::unsetenv(const char* name) {
assert(name != NULL, "Null pointer");
return (SetEnvironmentVariable(name, NULL) == TRUE);
@@ -188,9 +183,13 @@
char *dll_path;
char *pslash;
char *bin = "\\bin";
- char home_dir[MAX_PATH];
-
- if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) {
+ char home_dir[MAX_PATH + 1];
+ char *alt_home_dir = ::getenv("_ALT_JAVA_HOME_DIR");
+
+ if (alt_home_dir != NULL) {
+ strncpy(home_dir, alt_home_dir, MAX_PATH + 1);
+ home_dir[MAX_PATH] = '\0';
+ } else {
os::jvm_path(home_dir, sizeof(home_dir));
// Found the full path to jvm.dll.
// Now cut the path to <java_home>/jre if we can.
@@ -5930,4 +5929,3 @@
UseNUMAInterleaving = old_use_numa_interleaving;
}
#endif // PRODUCT
-