8327621: Check return value of uname in os::get_host_name
Reviewed-by: dholmes, stuefe
This commit is contained in:
parent
bea9acc55a
commit
51ed69a586
@ -621,9 +621,14 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
|
||||
|
||||
bool os::get_host_name(char* buf, size_t buflen) {
|
||||
struct utsname name;
|
||||
uname(&name);
|
||||
jio_snprintf(buf, buflen, "%s", name.nodename);
|
||||
return true;
|
||||
int retcode = uname(&name);
|
||||
if (retcode != -1) {
|
||||
jio_snprintf(buf, buflen, "%s", name.nodename);
|
||||
return true;
|
||||
}
|
||||
const char* errmsg = os::strerror(errno);
|
||||
log_warning(os)("Failed to get host name, error message: %s", errmsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef _LP64
|
||||
|
Loading…
Reference in New Issue
Block a user