diff --git a/bindings/java/src/jni/javasigar.c b/bindings/java/src/jni/javasigar.c index c28d9f4b..fe7c116f 100644 --- a/bindings/java/src/jni/javasigar.c +++ b/bindings/java/src/jni/javasigar.c @@ -319,7 +319,7 @@ JNIEXPORT void SIGAR_JNIx(kill) SetObjectField(env, obj, fieldID, JENV->NewStringUTF(env, val)) static jstring jnet_address_to_string(JNIEnv *env, sigar_t *sigar, sigar_net_address_t *val) { - char addr_str[INET6_ADDRSTRLEN]; + char addr_str[SIGAR_INET6_ADDRSTRLEN]; sigar_net_address_to_string(sigar, val, addr_str); return JENV->NewStringUTF(env, addr_str); } diff --git a/include/sigar.h b/include/sigar.h index 575dfa4b..49049c4f 100644 --- a/include/sigar.h +++ b/include/sigar.h @@ -429,19 +429,17 @@ SIGAR_DECLARE(int) sigar_net_address_to_string(sigar_t *sigar, SIGAR_DECLARE(sigar_uint32_t) sigar_net_address_hash(sigar_net_address_t *address); -#ifndef INET6_ADDRSTRLEN -# define INET6_ADDRSTRLEN 46 -#endif +#define SIGAR_INET6_ADDRSTRLEN 46 #define SIGAR_MAXDOMAINNAMELEN 256 #define SIGAR_MAXHOSTNAMELEN 256 typedef struct { - char default_gateway[INET6_ADDRSTRLEN]; + char default_gateway[SIGAR_INET6_ADDRSTRLEN]; char host_name[SIGAR_MAXHOSTNAMELEN]; char domain_name[SIGAR_MAXDOMAINNAMELEN]; - char primary_dns[INET6_ADDRSTRLEN]; - char secondary_dns[INET6_ADDRSTRLEN]; + char primary_dns[SIGAR_INET6_ADDRSTRLEN]; + char secondary_dns[SIGAR_INET6_ADDRSTRLEN]; } sigar_net_info_t; SIGAR_DECLARE(int) diff --git a/src/sigar.c b/src/sigar.c index c7c242f9..65a0d4a4 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -1776,7 +1776,7 @@ SIGAR_DECLARE(int) sigar_net_address_to_string(sigar_t *sigar, case SIGAR_AF_INET6: #if defined(__linux__) /*XXX*/ if (inet_ntop(AF_INET6, (const void *)&address->addr.in6, - addr_str, INET6_ADDRSTRLEN)) + addr_str, SIGAR_INET6_ADDRSTRLEN)) { return SIGAR_OK; } @@ -2019,7 +2019,7 @@ SIGAR_DECLARE(int) sigar_fqdn_get(sigar_t *sigar, char *name, int namelen) int i,j; for (i=0; p->h_addr_list[i]; i++) { - char addr[INET6_ADDRSTRLEN]; + char addr[SIGAR_INET6_ADDRSTRLEN]; struct in_addr *in = (struct in_addr *)p->h_addr_list[i];