unix net_info.host_name
This commit is contained in:
parent
006d84e029
commit
b3ca673da2
|
@ -875,6 +875,14 @@ int sigar_net_info_get(sigar_t *sigar,
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
size = sizeof(netinfo->host_name)-1;
|
||||||
|
if (gethostname(netinfo->host_name, size) == 0) {
|
||||||
|
netinfo->host_name[size] = '\0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
netinfo->host_name[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
size = sizeof(netinfo->domain_name)-1;
|
size = sizeof(netinfo->domain_name)-1;
|
||||||
if (getdomainname(netinfo->domain_name, size) == 0) {
|
if (getdomainname(netinfo->domain_name, size) == 0) {
|
||||||
netinfo->domain_name[size] = '\0';
|
netinfo->domain_name[size] = '\0';
|
||||||
|
|
Loading…
Reference in New Issue