sanity check getdomainname

This commit is contained in:
Doug MacEachern 2005-07-11 20:37:47 +00:00
parent b7c19ce5d3
commit b000f97bd3
1 changed files with 6 additions and 2 deletions

View File

@ -880,8 +880,12 @@ int sigar_net_info_get(sigar_t *sigar,
fclose(fp); fclose(fp);
getdomainname(netinfo->domain, sizeof(netinfo->domain)); if (getdomainname(netinfo->domain, sizeof(netinfo->domain)) == 0) {
netinfo->domain[sizeof(netinfo->domain)-1] = '\0'; netinfo->domain[sizeof(netinfo->domain)-1] = '\0';
}
else {
netinfo->domain[0] = '\0';
}
return SIGAR_OK; return SIGAR_OK;
} }