sanity check getdomainname
This commit is contained in:
parent
b7c19ce5d3
commit
b000f97bd3
|
@ -880,8 +880,12 @@ int sigar_net_info_get(sigar_t *sigar,
|
|||
|
||||
fclose(fp);
|
||||
|
||||
getdomainname(netinfo->domain, sizeof(netinfo->domain));
|
||||
netinfo->domain[sizeof(netinfo->domain)-1] = '\0';
|
||||
if (getdomainname(netinfo->domain, sizeof(netinfo->domain)) == 0) {
|
||||
netinfo->domain[sizeof(netinfo->domain)-1] = '\0';
|
||||
}
|
||||
else {
|
||||
netinfo->domain[0] = '\0';
|
||||
}
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue