8074895: os::getenv is inadequate

Reviewed-by: dholmes, coleenp
This commit is contained in:
Jeremy Manson 2015-03-30 17:32:18 -04:00
parent 67e0ba13c0
commit 0353353bde
11 changed files with 106 additions and 141 deletions

View file

@ -555,17 +555,6 @@ bool os::bind_to_processor(uint processor_id) {
return (bind_result == 0);
}
bool os::getenv(const char* name, char* buffer, int len) {
char* val = ::getenv(name);
if (val == NULL || strlen(val) + 1 > len) {
if (len > 0) buffer[0] = 0; // return a null string
return false;
}
strcpy(buffer, val);
return true;
}
// Return true if user is running as root.
bool os::have_special_privileges() {