diff --git a/bindings/java/src/jni/generate.pl b/bindings/java/src/jni/generate.pl index 2cc05b17..b7b610ac 100644 --- a/bindings/java/src/jni/generate.pl +++ b/bindings/java/src/jni/generate.pl @@ -569,7 +569,7 @@ my %classes = ( plat => '' }, { - name => 'domain', type => 'String', + name => 'domain_name', type => 'String', desc => '', plat => '' }, diff --git a/bindings/java/src/net/hyperic/sigar/cmd/NetInfo.java b/bindings/java/src/net/hyperic/sigar/cmd/NetInfo.java index e1dedb3f..ab97d69c 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/NetInfo.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/NetInfo.java @@ -23,8 +23,8 @@ public class NetInfo extends SigarCommandBase { net.hyperic.sigar.NetInfo info = this.sigar.getNetInfo(); - println("domain................" + - info.getDomain()); + println("domain name..........." + + info.getDomainName()); println("default gateway......." + info.getDefaultGateway()); diff --git a/include/sigar.h b/include/sigar.h index e68f7e9d..b2f598f6 100644 --- a/include/sigar.h +++ b/include/sigar.h @@ -391,7 +391,7 @@ sigar_file_system_usage_get(sigar_t *sigar, typedef struct { char default_gateway[INET6_ADDRSTRLEN]; - char domain[SIGAR_MAXDOMAINNAMELEN]; + char domain_name[SIGAR_MAXDOMAINNAMELEN]; char dhcp_server[INET6_ADDRSTRLEN]; char primary_dns[INET6_ADDRSTRLEN]; char secondary_dns[INET6_ADDRSTRLEN]; diff --git a/src/sigar.c b/src/sigar.c index 57e9db40..895e8580 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -845,6 +845,7 @@ int sigar_who_list_get(sigar_t *sigar, int sigar_net_info_get(sigar_t *sigar, sigar_net_info_t *netinfo) { + int size; char buffer[BUFSIZ], *ptr; FILE *fp; @@ -880,11 +881,12 @@ int sigar_net_info_get(sigar_t *sigar, fclose(fp); - if (getdomainname(netinfo->domain, sizeof(netinfo->domain)) == 0) { - netinfo->domain[sizeof(netinfo->domain)-1] = '\0'; + size = sizeof(netinfo->domain_name)-1; + if (getdomainname(netinfo->domain_name, size) == 0) { + netinfo->domain_name[size] = '\0'; } else { - netinfo->domain[0] = '\0'; + netinfo->domain_name[0] = '\0'; } return SIGAR_OK;