unix net_info.host_name

This commit is contained in:
Doug MacEachern committed 2005-07-11 22:45:50 +00:00
1 parent 006d84e029
commit b3ca673da2
1 file changed
+8
+8
View File
@@ -875,6 +875,14 @@ int sigar_net_info_get(sigar_t *sigar,
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;
if (getdomainname(netinfo->domain_name, size) == 0) {
netinfo->domain_name[size] = '\0';